A Discrete-Event Network Simulator
API
random-walk-2d-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) 2006,2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef RANDOM_WALK_2D_MOBILITY_MODEL_H
21 #define RANDOM_WALK_2D_MOBILITY_MODEL_H
22 
23 #include "ns3/object.h"
24 #include "ns3/nstime.h"
25 #include "ns3/event-id.h"
26 #include "ns3/rectangle.h"
27 #include "ns3/random-variable-stream.h"
28 #include "mobility-model.h"
30 
31 namespace ns3 {
32 
33 
47 {
48 public:
53  static TypeId GetTypeId (void);
55  enum Mode {
57  MODE_TIME
58  };
59 
60 private:
65  void Rebound (Time timeLeft);
71  void DoWalk (Time timeLeft);
75  void DoInitializePrivate (void);
76  virtual void DoDispose (void);
77  virtual void DoInitialize (void);
78  virtual Vector DoGetPosition (void) const;
79  virtual void DoSetPosition (const Vector &position);
80  virtual Vector DoGetVelocity (void) const;
81  virtual int64_t DoAssignStreams (int64_t);
82 
85  enum Mode m_mode;
86  double m_modeDistance;
91 };
92 
93 
94 } // namespace ns3
95 
96 #endif /* RANDOM_WALK_2D_MOBILITY_MODEL_H */
Utility class used to move node with constant velocity.
An identifier for simulation events.
Definition: event-id.h:54
Keep track of the current position and velocity of an object.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
void DoInitializePrivate(void)
Perform initialization of the object before MobilityModel::DoInitialize ()
Ptr< RandomVariableStream > m_speed
rv for picking speed
virtual void DoSetPosition(const Vector &position)
virtual void DoInitialize(void)
Initialize() implementation.
virtual int64_t DoAssignStreams(int64_t)
The default implementation does nothing but return the passed-in parameter.
double m_modeDistance
Change direction and speed after this distance.
void DoWalk(Time timeLeft)
Walk according to position and velocity, until distance is reached, time is reached,...
enum Mode m_mode
whether in time or distance mode
Mode
An enum representing the different working modes of this module.
void Rebound(Time timeLeft)
Performs the rebound of the node if it reaches a boundary.
ConstantVelocityHelper m_helper
helper for this object
virtual void DoDispose(void)
Destructor implementation.
Time m_modeTime
Change current direction and speed after this delay.
Rectangle m_bounds
Bounds of the area to cruise.
Ptr< RandomVariableStream > m_direction
rv for picking direction
a 2d rectangle
Definition: rectangle.h:35
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.