A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
waypoint-mobility-model.h
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 
29 namespace ns3 {
30 
85 {
86 public:
87  static TypeId GetTypeId (void);
88 
93  virtual ~WaypointMobilityModel ();
94 
104  void AddWaypoint (const Waypoint &waypoint);
105 
109  Waypoint GetNextWaypoint (void) const;
110 
115  uint32_t WaypointsLeft (void) const;
116 
123  void EndMobility (void);
124 
125 private:
126  friend class WaypointMobilityModelNotifyTest; // To allow Update() calls and access to m_current
127 
128  void Update (void) const;
129  virtual void DoDispose (void);
130  virtual Vector DoGetPosition (void) const;
131  virtual void DoSetPosition (const Vector &position);
132  virtual Vector DoGetVelocity (void) const;
133 
134  bool m_first;
135  bool m_lazyNotify;
136  bool m_initialPositionIsWaypoint;
137  mutable std::deque<Waypoint> m_waypoints;
138  mutable Waypoint m_current;
139  mutable Waypoint m_next;
140  mutable Vector m_velocity;
141 };
142 
143 } // namespace ns3
144 
145 #endif /* WAYPOINT_MOBILITY_MODEL_H */
146 
virtual Vector DoGetVelocity(void) const
void AddWaypoint(const Waypoint &waypoint)
virtual Vector DoGetPosition(void) const
a 3d vector
Definition: vector.h:31
Keep track of the current position and velocity of an object.
virtual void DoSetPosition(const Vector &position)
Waypoint-based mobility model.
Waypoint GetNextWaypoint(void) const
a unique identifier for an interface.
Definition: type-id.h:44
a (time, location) pair.
Definition: waypoint.h:34