A Discrete-Event Network Simulator
API
random-direction-2d-mobility-model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 #ifndef RANDOM_DIRECTION_MOBILITY_MODEL_H
20 #define RANDOM_DIRECTION_MOBILITY_MODEL_H
21 
23 #include "mobility-model.h"
24 #include "rectangle.h"
25 
26 #include "ns3/event-id.h"
27 #include "ns3/nstime.h"
28 #include "ns3/object.h"
29 #include "ns3/ptr.h"
30 #include "ns3/random-variable-stream.h"
31 
32 namespace ns3
33 {
34 
46 {
47  public:
52  static TypeId GetTypeId();
54 
55  private:
63  void BeginPause();
68  void SetDirectionAndSpeed(double direction);
72  void DoInitializePrivate();
73  void DoDispose() override;
74  void DoInitialize() override;
75  Vector DoGetPosition() const override;
76  void DoSetPosition(const Vector& position) override;
77  Vector DoGetVelocity() const override;
78  int64_t DoAssignStreams(int64_t) override;
79 
86 };
87 
88 } // namespace ns3
89 
90 #endif /* RANDOM_DIRECTION_MOBILITY_MODEL_H */
Utility class used to move node with constant velocity.
An identifier for simulation events.
Definition: event-id.h:55
Keep track of the current position and velocity of an object.
void DoSetPosition(const Vector &position) override
void SetDirectionAndSpeed(double direction)
Set new velocity and direction, and schedule next pause event.
EventId m_event
event ID of next scheduled event
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
ConstantVelocityHelper m_helper
helper for velocity computations
void BeginPause()
Pause, cancel currently scheduled event, schedule end of pause event.
void DoInitializePrivate()
Sets a new random direction and calls SetDirectionAndSpeed.
void DoInitialize() override
Initialize() implementation.
static TypeId GetTypeId()
Register this type with the TypeId system.
void DoDispose() override
Destructor implementation.
Ptr< RandomVariableStream > m_speed
a random variable to control speed
void ResetDirectionAndSpeed()
Set a new direction and speed.
Ptr< UniformRandomVariable > m_direction
rv to control direction
Ptr< RandomVariableStream > m_pause
a random variable to control pause
a 2d rectangle
Definition: rectangle.h:35
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.