A Discrete-Event Network Simulator
API
waypoint-mobility-model.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 Phillip Sitbon
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Phillip Sitbon <phillip@sitbon.net>
19  */
20 #ifndef WAYPOINT_MOBILITY_MODEL_H
21 #define WAYPOINT_MOBILITY_MODEL_H
22 
23 #include <stdint.h>
24 #include <deque>
25 #include "mobility-model.h"
26 #include "ns3/vector.h"
27 #include "waypoint.h"
28 
30 
31 namespace ns3 {
32 
87 {
88 public:
93  static TypeId GetTypeId (void);
94 
99  virtual ~WaypointMobilityModel ();
100 
110  void AddWaypoint (const Waypoint &waypoint);
111 
116  Waypoint GetNextWaypoint (void) const;
117 
123  uint32_t WaypointsLeft (void) const;
124 
131  void EndMobility (void);
132 
133 private:
134  friend class ::WaypointMobilityModelNotifyTest; // To allow Update() calls and access to m_current
135 
139  virtual void Update (void) const;
145  virtual void DoDispose (void);
150  virtual Vector DoGetPosition (void) const;
155  virtual void DoSetPosition (const Vector &position);
160  virtual Vector DoGetVelocity (void) const;
161 
162 protected:
166  bool m_first;
179  mutable std::deque<Waypoint> m_waypoints;
187  mutable Waypoint m_next;
191  mutable Vector m_velocity;
192 };
193 
194 } // namespace ns3
195 
196 #endif /* WAYPOINT_MOBILITY_MODEL_H */
197 
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
waypoint.h
ns3::WaypointMobilityModel::DoGetVelocity
virtual Vector DoGetVelocity(void) const
Returns the current velocity of a node.
Definition: waypoint-mobility-model.cc:211
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WaypointMobilityModel::m_waypoints
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
Definition: waypoint-mobility-model.h:179
ns3::WaypointMobilityModel::m_velocity
Vector m_velocity
The current velocity vector.
Definition: waypoint-mobility-model.h:191
ns3::WaypointMobilityModel::AddWaypoint
void AddWaypoint(const Waypoint &waypoint)
Definition: waypoint-mobility-model.cc:82
ns3::WaypointMobilityModel::DoGetPosition
virtual Vector DoGetPosition(void) const
Get current position.
Definition: waypoint-mobility-model.cc:175
ns3::WaypointMobilityModel::Update
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
Definition: waypoint-mobility-model.cc:114
ns3::WaypointMobilityModel
Waypoint-based mobility model.
Definition: waypoint-mobility-model.h:87
ns3::WaypointMobilityModel::~WaypointMobilityModel
virtual ~WaypointMobilityModel()
Definition: waypoint-mobility-model.cc:73
ns3::WaypointMobilityModel::EndMobility
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
Definition: waypoint-mobility-model.cc:203
ns3::WaypointMobilityModel::GetNextWaypoint
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
Definition: waypoint-mobility-model.cc:102
mobility-model.h
ns3::WaypointMobilityModel::DoDispose
virtual void DoDispose(void)
The dispose method.
Definition: waypoint-mobility-model.cc:77
WaypointMobilityModelNotifyTest
Waypoint Mobility Model Notify Test.
Definition: waypoint-mobility-model-test.cc:36
ns3::WaypointMobilityModel::WaypointMobilityModel
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
Definition: waypoint-mobility-model.cc:67
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:166
ns3::Waypoint
a (time, location) pair.
Definition: waypoint.h:36
ns3::WaypointMobilityModel::DoSetPosition
virtual void DoSetPosition(const Vector &position)
Sets a new position for the node
Definition: waypoint-mobility-model.cc:181
ns3::WaypointMobilityModel::WaypointsLeft
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.
Definition: waypoint-mobility-model.cc:108
ns3::WaypointMobilityModel::GetTypeId
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Definition: waypoint-mobility-model.cc:38
ns3::WaypointMobilityModel::m_lazyNotify
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
Definition: waypoint-mobility-model.h:171
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition: mobility-model.h:40
ns3::WaypointMobilityModel::m_next
Waypoint m_next
The next ns3::Waypoint in the deque.
Definition: waypoint-mobility-model.h:187
ns3::WaypointMobilityModel::m_current
Waypoint m_current
The ns3::Waypoint currently being used.
Definition: waypoint-mobility-model.h:183
ns3::WaypointMobilityModel::m_initialPositionIsWaypoint
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.
Definition: waypoint-mobility-model.h:175