StaticSpeedHelper -> ConstantVelocityHelper
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef STATIC_MOBILITY_MODEL_H
|
||||
#define STATIC_MOBILITY_MODEL_H
|
||||
#ifndef CONSTANT_POSITION_MOBILITY_MODEL_H
|
||||
#define CONSTANT_POSITION_MOBILITY_MODEL_H
|
||||
|
||||
#include "mobility-model.h"
|
||||
#include "vector.h"
|
||||
@@ -50,4 +50,4 @@ private:
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
#endif /* STATIC_MOBILITY_MODEL_H */
|
||||
#endif /* CONSTANT_POSITION_MOBILITY_MODEL_H */
|
||||
|
||||
@@ -19,25 +19,25 @@
|
||||
*/
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/rectangle.h"
|
||||
#include "static-speed-helper.h"
|
||||
#include "constant-velocity-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
StaticSpeedHelper::StaticSpeedHelper ()
|
||||
ConstantVelocityHelper::ConstantVelocityHelper ()
|
||||
: m_paused (true)
|
||||
{}
|
||||
StaticSpeedHelper::StaticSpeedHelper (const Vector &position)
|
||||
ConstantVelocityHelper::ConstantVelocityHelper (const Vector &position)
|
||||
: m_position (position),
|
||||
m_paused (true)
|
||||
{}
|
||||
StaticSpeedHelper::StaticSpeedHelper (const Vector &position,
|
||||
ConstantVelocityHelper::ConstantVelocityHelper (const Vector &position,
|
||||
const Vector &vel)
|
||||
: m_position (position),
|
||||
m_velocity (vel),
|
||||
m_paused (true)
|
||||
{}
|
||||
void
|
||||
StaticSpeedHelper::SetPosition (const Vector &position)
|
||||
ConstantVelocityHelper::SetPosition (const Vector &position)
|
||||
{
|
||||
m_position = position;
|
||||
m_velocity = Vector (0.0, 0.0, 0.0);
|
||||
@@ -45,25 +45,25 @@ StaticSpeedHelper::SetPosition (const Vector &position)
|
||||
}
|
||||
|
||||
Vector
|
||||
StaticSpeedHelper::GetCurrentPosition (void) const
|
||||
ConstantVelocityHelper::GetCurrentPosition (void) const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
Vector
|
||||
StaticSpeedHelper::GetVelocity (void) const
|
||||
ConstantVelocityHelper::GetVelocity (void) const
|
||||
{
|
||||
return m_paused? Vector (0.0, 0.0, 0.0) : m_velocity;
|
||||
}
|
||||
void
|
||||
StaticSpeedHelper::SetVelocity (const Vector &vel)
|
||||
ConstantVelocityHelper::SetVelocity (const Vector &vel)
|
||||
{
|
||||
m_velocity = vel;
|
||||
m_lastUpdate = Simulator::Now ();
|
||||
}
|
||||
|
||||
void
|
||||
StaticSpeedHelper::Update (void) const
|
||||
ConstantVelocityHelper::Update (void) const
|
||||
{
|
||||
Time now = Simulator::Now ();
|
||||
NS_ASSERT (m_lastUpdate <= now);
|
||||
@@ -80,7 +80,7 @@ StaticSpeedHelper::Update (void) const
|
||||
}
|
||||
|
||||
void
|
||||
StaticSpeedHelper::UpdateWithBounds (const Rectangle &bounds) const
|
||||
ConstantVelocityHelper::UpdateWithBounds (const Rectangle &bounds) const
|
||||
{
|
||||
Update ();
|
||||
m_position.x = std::min (bounds.xMax, m_position.x);
|
||||
@@ -90,13 +90,13 @@ StaticSpeedHelper::UpdateWithBounds (const Rectangle &bounds) const
|
||||
}
|
||||
|
||||
void
|
||||
StaticSpeedHelper::Pause (void)
|
||||
ConstantVelocityHelper::Pause (void)
|
||||
{
|
||||
m_paused = true;
|
||||
}
|
||||
|
||||
void
|
||||
StaticSpeedHelper::Unpause (void)
|
||||
ConstantVelocityHelper::Unpause (void)
|
||||
{
|
||||
m_paused = false;
|
||||
}
|
||||
@@ -17,8 +17,8 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef STATIC_SPEED_HELPER_H
|
||||
#define STATIC_SPEED_HELPER_H
|
||||
#ifndef CONSTANT_VELOCITY_HELPER_H
|
||||
#define CONSTANT_VELOCITY_HELPER_H
|
||||
|
||||
#include "ns3/nstime.h"
|
||||
#include "vector.h"
|
||||
@@ -27,12 +27,12 @@ namespace ns3 {
|
||||
|
||||
class Rectangle;
|
||||
|
||||
class StaticSpeedHelper
|
||||
class ConstantVelocityHelper
|
||||
{
|
||||
public:
|
||||
StaticSpeedHelper ();
|
||||
StaticSpeedHelper (const Vector &position);
|
||||
StaticSpeedHelper (const Vector &position,
|
||||
ConstantVelocityHelper ();
|
||||
ConstantVelocityHelper (const Vector &position);
|
||||
ConstantVelocityHelper (const Vector &position,
|
||||
const Vector &vel);
|
||||
|
||||
void SetPosition (const Vector &position);
|
||||
@@ -53,4 +53,4 @@ class StaticSpeedHelper
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* STATIC_SPEED_HELPER_H */
|
||||
#endif /* CONSTANT_VELOCITY_HELPER_H */
|
||||
@@ -17,13 +17,13 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
#ifndef STATIC_SPEED_MOBILITY_MODEL_H
|
||||
#define STATIC_SPEED_MOBILITY_MODEL_H
|
||||
#ifndef CONSTANT_VELOCITY_MOBILITY_MODEL_H
|
||||
#define CONSTANT_VELOCITY_MOBILITY_MODEL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mobility-model.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "static-speed-helper.h"
|
||||
#include "constant-velocity-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -55,9 +55,9 @@ private:
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
void Update (void) const;
|
||||
StaticSpeedHelper m_helper;
|
||||
ConstantVelocityHelper m_helper;
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
#endif /* STATIC_SPEED_POSITION */
|
||||
#endif /* CONSTANT_VELOCITY_POSITION */
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "ns3/rectangle.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "mobility-model.h"
|
||||
#include "static-speed-helper.h"
|
||||
#include "constant-velocity-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -63,7 +63,7 @@ class RandomDirection2dMobilityModel : public MobilityModel
|
||||
RandomVariable m_speed;
|
||||
RandomVariable m_pause;
|
||||
EventId m_event;
|
||||
StaticSpeedHelper m_helper;
|
||||
ConstantVelocityHelper m_helper;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "ns3/rectangle.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "mobility-model.h"
|
||||
#include "static-speed-helper.h"
|
||||
#include "constant-velocity-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -63,7 +63,7 @@ class RandomWalk2dMobilityModel : public MobilityModel
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
StaticSpeedHelper m_helper;
|
||||
ConstantVelocityHelper m_helper;
|
||||
EventId m_event;
|
||||
enum Mode m_mode;
|
||||
double m_modeDistance;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef RANDOM_WAYPOINT_MOBILITY_MODEL_H
|
||||
#define RANDOM_WAYPOINT_MOBILITY_MODEL_H
|
||||
|
||||
#include "static-speed-helper.h"
|
||||
#include "constant-velocity-helper.h"
|
||||
#include "mobility-model.h"
|
||||
#include "position-allocator.h"
|
||||
#include "ns3/ptr.h"
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
virtual void DoSetPosition (const Vector &position);
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
|
||||
StaticSpeedHelper m_helper;
|
||||
ConstantVelocityHelper m_helper;
|
||||
Ptr<PositionAllocator> m_position;
|
||||
RandomVariable m_speed;
|
||||
RandomVariable m_pause;
|
||||
|
||||
@@ -9,7 +9,7 @@ def build(bld):
|
||||
'position-allocator.cc',
|
||||
'rectangle.cc',
|
||||
'constant-position-mobility-model.cc',
|
||||
'static-speed-helper.cc',
|
||||
'constant-velocity-helper.cc',
|
||||
'constant-velocity-mobility-model.cc',
|
||||
'random-waypoint-mobility-model.cc',
|
||||
'random-walk-2d-mobility-model.cc',
|
||||
@@ -25,7 +25,7 @@ def build(bld):
|
||||
'position-allocator.h',
|
||||
'rectangle.h',
|
||||
'constant-position-mobility-model.h',
|
||||
'static-speed-helper.h',
|
||||
'constant-velocity-helper.h',
|
||||
'constant-velocity-mobility-model.h',
|
||||
'random-waypoint-mobility-model.h',
|
||||
'random-walk-2d-mobility-model.h',
|
||||
|
||||
Reference in New Issue
Block a user