22 #include "ns3/trace-source-accessor.h"
35 TypeId(
"ns3::MobilityModel")
37 .SetGroupName(
"Mobility")
40 "The current position of the mobility model.",
42 VectorValue(Vector(0.0, 0.0, 0.0)),
45 .AddAttribute(
"Velocity",
46 "The current velocity of the mobility model.",
48 VectorValue(Vector(0.0, 0.0, 0.0)),
51 .AddTraceSource(
"CourseChange",
52 "The value of the position and/or velocity vector changed",
54 "ns3::MobilityModel::TracedCallback");
100 Vector oPosition = other->DoGetPosition();
108 return (
GetVelocity() - other->GetVelocity()).GetLength();
ns3::TracedCallback< Ptr< const MobilityModel > > m_courseChangeTrace
Used to alert subscribers that a change in direction, velocity, or position has occurred.
Vector GetPositionWithReference(const Vector &referencePosition) const
This method may be used if the position returned may depend on some reference position provided.
static TypeId GetTypeId()
Register this type with the TypeId system.
double GetDistanceFrom(Ptr< const MobilityModel > position) const
~MobilityModel() override=0
double GetRelativeSpeed(Ptr< const MobilityModel > other) const
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
virtual Vector DoGetPosition() const =0
virtual Vector DoGetPositionWithReference(const Vector &referencePosition) const
Vector GetVelocity() const
virtual void DoSetPosition(const Vector &position)=0
virtual int64_t DoAssignStreams(int64_t start)
The default implementation does nothing but return the passed-in parameter.
Vector GetPosition() const
void SetPosition(const Vector &position)
void NotifyCourseChange() const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
virtual Vector DoGetVelocity() const =0
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
@ ATTR_SET
The attribute can be written.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeVectorChecker()
Ptr< const AttributeAccessor > MakeVectorAccessor(T1 a1)
double CalculateDistance(const Vector3D &a, const Vector3D &b)