24 #include "ns3/trace-source-accessor.h"
35 .SetGroupName (
"Mobility")
36 .AddAttribute (
"Position",
"The current position of the mobility model.",
42 .AddAttribute (
"Velocity",
"The current velocity of the mobility model.",
47 .AddTraceSource (
"CourseChange",
48 "The value of the position and/or velocity vector changed",
50 "ns3::MobilityModel::CourseChangeTracedCallback")
83 Vector oPosition = other->DoGetPosition ();
92 double y =
GetVelocity().y - other->GetVelocity().y;
93 double z =
GetVelocity().z - other->GetVelocity().z;
94 return sqrt( (x*x) + (y*y) + (z*z) );
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Smart pointer class similar to boost::intrusive_ptr.
double GetDistanceFrom(Ptr< const MobilityModel > position) const
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual Vector DoGetPosition(void) const =0
Vector GetPosition(void) const
virtual ~MobilityModel()=0
Vector GetVelocity(void) const
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
The attribute can be read.
ns3::TracedCallback< Ptr< const MobilityModel > > m_courseChangeTrace
Used to alert subscribers that a change in direction, velocity, or position has occurred.
double CalculateDistance(const Vector3D &a, const Vector3D &b)
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeVectorChecker(void)
The attribute can be written.
void SetPosition(const Vector &position)
Ptr< const AttributeAccessor > MakeVectorAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void DoSetPosition(const Vector &position)=0
AttributeValue implementation for Vector3D.
A base class which provides memory management and object aggregation.
virtual Vector DoGetVelocity(void) const =0
virtual int64_t DoAssignStreams(int64_t start)
The default implementation does nothing but return the passed-in parameter.
a unique identifier for an interface.
double GetRelativeSpeed(Ptr< const MobilityModel > other) const
TypeId SetParent(TypeId tid)