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 
115  Waypoint GetNextWaypoint (void) const;
116 
121  uint32_t WaypointsLeft (void) const;
122 
129  void EndMobility (void);
130 
131 private:
132  friend class ::WaypointMobilityModelNotifyTest; // To allow Update() calls and access to m_current
133 
137  virtual void Update (void) const;
143  virtual void DoDispose (void);
148  virtual Vector DoGetPosition (void) const;
153  virtual void DoSetPosition (const Vector &position);
158  virtual Vector DoGetVelocity (void) const;
159 
160 protected:
164  bool m_first;
177  mutable std::deque<Waypoint> m_waypoints;
185  mutable Waypoint m_next;
189  mutable Vector m_velocity;
190 };
191 
192 } // namespace ns3
193 
194 #endif /* WAYPOINT_MOBILITY_MODEL_H */
195 
virtual void DoDispose(void)
The dispose method.
virtual Vector DoGetVelocity(void) const
Returns the current velocity of a node.
Waypoint Mobility Model Notify Test.
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
void AddWaypoint(const Waypoint &waypoint)
Vector m_velocity
The current velocity vector.
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.
Keep track of the current position and velocity of an object.
bool m_first
This variable is set to true if there are no waypoints in the std::deque.
virtual void DoSetPosition(const Vector &position)
Sets a new position for the node
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Waypoint m_next
The next ns3::Waypoint in the deque.
virtual Vector DoGetPosition(void) const
Get current position.
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
Waypoint m_current
The ns3::Waypoint currently being used.
Waypoint-based mobility model.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
a unique identifier for an interface.
Definition: type-id.h:58
a (time, location) pair.
Definition: waypoint.h:35
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.