|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/abort.h"
22 #include "ns3/simulator.h"
23 #include "ns3/uinteger.h"
25 #include "ns3/boolean.h"
27 #include "ns3/config.h"
40 static TypeId tid =
TypeId (
"ns3::WaypointMobilityModel")
42 .SetGroupName (
"Mobility")
44 .AddAttribute (
"NextWaypoint",
"The next waypoint used to determine position.",
49 .AddAttribute (
"WaypointsLeft",
"The number of waypoints remaining.",
53 MakeUintegerChecker<uint32_t> ())
54 .AddAttribute (
"LazyNotify",
"Only call NotifyCourseChange when position is calculated.",
58 .AddAttribute (
"InitialPositionIsWaypoint",
"Calling SetPosition with no waypoints creates a waypoint.",
70 m_initialPositionIsWaypoint (false)
92 "Waypoints must be added in ascending time order");
117 bool newWaypoint =
false;
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual Vector DoGetVelocity(void) const
Returns the current velocity of a node.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
AttributeValue implementation for Boolean.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::deque< Waypoint > m_waypoints
The double ended queue containing the ns3::Waypoint objects.
Vector m_velocity
The current velocity vector.
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
void AddWaypoint(const Waypoint &waypoint)
@ ATTR_GET
The attribute can be read.
Ptr< const AttributeChecker > MakeWaypointChecker(void)
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual Vector DoGetPosition(void) const
Get current position.
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
Waypoint-based mobility model.
virtual ~WaypointMobilityModel()
void EndMobility(void)
Clear any existing waypoints and set the current waypoint time to infinity.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Waypoint GetNextWaypoint(void) const
Get the waypoint that this object is traveling towards.
Simulation virtual time values and global simulation resolution.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
virtual void DoDispose(void)
The dispose method.
AttributeValue implementation for Waypoint.
WaypointMobilityModel()
Create a path with no waypoints at location (0,0,0).
Time time
The waypoint time.
bool m_first
This variable is set to true if there are no waypoints in the std::deque.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual void DoSetPosition(const Vector &position)
Sets a new position for the node
Ptr< const AttributeAccessor > MakeWaypointAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
uint32_t WaypointsLeft(void) const
Get the number of waypoints left for this object, excluding the next one.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
bool m_lazyNotify
If true, course change updates are only notified when position is calculated.
Vector position
The position of the waypoint.
Keep track of the current position and velocity of an object.
Waypoint m_next
The next ns3::Waypoint in the deque.
Hold an unsigned integer type.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Waypoint m_current
The ns3::Waypoint currently being used.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
virtual void DoDispose(void)
Destructor implementation.
bool m_initialPositionIsWaypoint
If true, calling SetPosition with no waypoints creates a waypoint.