Utility class used to move node with constant velocity. More...
#include "constant-velocity-helper.h"
Public Member Functions | |
ConstantVelocityHelper () | |
ConstantVelocityHelper (const Vector &position) | |
Create object and set position. | |
ConstantVelocityHelper (const Vector &position, const Vector &vel) | |
Create object and set position and velocity. | |
Vector | GetCurrentPosition () const |
Get current position vector. | |
Vector | GetVelocity () const |
Get velocity; if paused, will return a zero vector. | |
void | Pause () |
Pause mobility at current position. | |
void | SetPosition (const Vector &position) |
Set position vector. | |
void | SetVelocity (const Vector &vel) |
Set new velocity vector. | |
void | Unpause () |
Resume mobility from current position at current velocity. | |
void | Update () const |
Update position, if not paused, from last position and time of last update. | |
void | UpdateWithBounds (const Box &bounds) const |
Update position, if not paused, from last position and time of last update. | |
void | UpdateWithBounds (const Rectangle &rectangle) const |
Update position, if not paused, from last position and time of last update. | |
Private Attributes | |
Time | m_lastUpdate |
time of last update | |
bool | m_paused |
state variable for paused | |
Vector | m_position |
state variable for current position | |
Vector | m_velocity |
state variable for velocity | |
Utility class used to move node with constant velocity.
Definition at line 26 of file constant-velocity-helper.h.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | ) |
Definition at line 21 of file constant-velocity-helper.cc.
References m_paused, and NS_LOG_FUNCTION.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | const Vector & | position | ) |
Create object and set position.
position | the position vector |
Definition at line 27 of file constant-velocity-helper.cc.
References m_paused, m_position, and NS_LOG_FUNCTION.
ns3::ConstantVelocityHelper::ConstantVelocityHelper | ( | const Vector & | position, |
const Vector & | vel ) |
Create object and set position and velocity.
position | the position vector |
vel | the velocity vector |
Definition at line 34 of file constant-velocity-helper.cc.
References m_paused, m_position, m_velocity, and NS_LOG_FUNCTION.
Vector ns3::ConstantVelocityHelper::GetCurrentPosition | ( | ) | const |
Get current position vector.
Definition at line 52 of file constant-velocity-helper.cc.
References m_position, and NS_LOG_FUNCTION.
Vector ns3::ConstantVelocityHelper::GetVelocity | ( | ) | const |
Get velocity; if paused, will return a zero vector.
Definition at line 59 of file constant-velocity-helper.cc.
References m_paused, m_velocity, and NS_LOG_FUNCTION.
void ns3::ConstantVelocityHelper::Pause | ( | ) |
Pause mobility at current position.
Definition at line 116 of file constant-velocity-helper.cc.
References m_paused, and NS_LOG_FUNCTION.
void ns3::ConstantVelocityHelper::SetPosition | ( | const Vector & | position | ) |
Set position vector.
position | Position vector |
Definition at line 43 of file constant-velocity-helper.cc.
References m_lastUpdate, m_position, m_velocity, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
void ns3::ConstantVelocityHelper::SetVelocity | ( | const Vector & | vel | ) |
Set new velocity vector.
vel | Velocity vector |
Definition at line 66 of file constant-velocity-helper.cc.
References m_lastUpdate, m_velocity, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
void ns3::ConstantVelocityHelper::Unpause | ( | ) |
Resume mobility from current position at current velocity.
Definition at line 123 of file constant-velocity-helper.cc.
References m_paused, and NS_LOG_FUNCTION.
void ns3::ConstantVelocityHelper::Update | ( | ) | const |
Update position, if not paused, from last position and time of last update.
Definition at line 74 of file constant-velocity-helper.cc.
References ns3::Time::GetSeconds(), m_lastUpdate, m_paused, m_position, m_velocity, ns3::Simulator::Now(), NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by UpdateWithBounds(), and UpdateWithBounds().
void ns3::ConstantVelocityHelper::UpdateWithBounds | ( | const Box & | bounds | ) | const |
Update position, if not paused, from last position and time of last update.
bounds | 3D bounding box for resulting position; object will not move outside the box |
Definition at line 103 of file constant-velocity-helper.cc.
References m_position, NS_LOG_FUNCTION, Update(), ns3::Box::xMax, ns3::Box::xMin, ns3::Box::yMax, ns3::Box::yMin, ns3::Box::zMax, and ns3::Box::zMin.
void ns3::ConstantVelocityHelper::UpdateWithBounds | ( | const Rectangle & | rectangle | ) | const |
Update position, if not paused, from last position and time of last update.
rectangle | 2D bounding rectangle for resulting position; object will not move outside the rectangle |
Definition at line 92 of file constant-velocity-helper.cc.
References m_position, NS_LOG_FUNCTION, Update(), ns3::Rectangle::xMax, ns3::Rectangle::xMin, ns3::Rectangle::yMax, and ns3::Rectangle::yMin.
|
mutableprivate |
time of last update
Definition at line 88 of file constant-velocity-helper.h.
Referenced by SetPosition(), SetVelocity(), and Update().
|
private |
state variable for paused
Definition at line 91 of file constant-velocity-helper.h.
Referenced by ConstantVelocityHelper(), ConstantVelocityHelper(), ConstantVelocityHelper(), GetVelocity(), Pause(), Unpause(), and Update().
|
mutableprivate |
state variable for current position
Definition at line 89 of file constant-velocity-helper.h.
Referenced by ConstantVelocityHelper(), ConstantVelocityHelper(), GetCurrentPosition(), SetPosition(), Update(), UpdateWithBounds(), and UpdateWithBounds().
|
private |
state variable for velocity
Definition at line 90 of file constant-velocity-helper.h.
Referenced by ConstantVelocityHelper(), GetVelocity(), SetPosition(), SetVelocity(), and Update().