A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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:
89  static TypeId GetTypeId (void);
90 
95  virtual ~WaypointMobilityModel ();
96 
106  void AddWaypoint (const Waypoint &waypoint);
107 
111  Waypoint GetNextWaypoint (void) const;
112 
117  uint32_t WaypointsLeft (void) const;
118 
125  void EndMobility (void);
126 
127 private:
128  friend class ::WaypointMobilityModelNotifyTest; // To allow Update() calls and access to m_current
129 
130  void Update (void) const;
131  virtual void DoDispose (void);
132  virtual Vector DoGetPosition (void) const;
133  virtual void DoSetPosition (const Vector &position);
134  virtual Vector DoGetVelocity (void) const;
135 
136  bool m_first;
139  mutable std::deque<Waypoint> m_waypoints;
141  mutable Waypoint m_next;
143 };
144 
145 } // namespace ns3
146 
147 #endif /* WAYPOINT_MOBILITY_MODEL_H */
148 
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual Vector DoGetVelocity(void) const
void AddWaypoint(const Waypoint &waypoint)
virtual Vector DoGetPosition(void) const
std::deque< Waypoint > m_waypoints
a 3d vector
Definition: vector.h:31
Keep track of the current position and velocity of an object.
virtual void DoSetPosition(const Vector &position)
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
Waypoint-based mobility model.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
a unique identifier for an interface.
Definition: type-id.h:49
a (time, location) pair.
Definition: waypoint.h:34
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.