21 #include "ns3/pointer.h"
23 #include "ns3/simulator.h"
34 static TypeId tid =
TypeId (
"ns3::HierarchicalMobilityModel")
36 .SetGroupName (
"Mobility")
38 .AddAttribute (
"Child",
"The child mobility model.",
42 MakePointerChecker<MobilityModel> ())
43 .AddAttribute (
"Parent",
"The parent mobility model.",
47 MakePointerChecker<MobilityModel> ())
132 return Vector (parentPosition.x + childPosition.x,
133 parentPosition.y + childPosition.y,
134 parentPosition.z + childPosition.z);
149 Vector childPosition (position.x - parentPosition.x,
150 position.y - parentPosition.y,
151 position.z - parentPosition.z);
166 Vector speed (parentSpeed.x + childSpeed.x,
167 parentSpeed.y + childSpeed.y,
168 parentSpeed.z + childSpeed.z);
204 int64_t streamsAllocated = 0;
207 return streamsAllocated;
Hierarchical mobility model.
Ptr< MobilityModel > m_child
pointer to child mobility model
static TypeId GetTypeId(void)
Register this type with the TypeId system.
virtual void DoSetPosition(const Vector &position)
void ChildChanged(Ptr< const MobilityModel > model)
Callback for when child mobility model course change occurs.
Ptr< MobilityModel > m_parent
pointer to parent mobility model
void SetParent(Ptr< MobilityModel > model)
Sets the parent mobility model to a new one, possibly replacing an existing one.
Ptr< MobilityModel > GetParent(void) const
HierarchicalMobilityModel()
virtual int64_t DoAssignStreams(int64_t)
The default implementation does nothing but return the passed-in parameter.
virtual void DoInitialize(void)
Initialize() implementation.
void SetChild(Ptr< MobilityModel > model)
Sets the child mobility model to a new one, possibly replacing an existing one.
virtual Vector DoGetPosition(void) const
virtual Vector DoGetVelocity(void) const
void ParentChanged(Ptr< const MobilityModel > model)
Callback for when parent mobility model course change occurs.
Ptr< MobilityModel > GetChild(void) const
Keep track of the current position and velocity of an object.
Vector GetPositionWithReference(const Vector &referencePosition) const
This method may be used if the position returned may depend on some reference position provided.
Vector GetVelocity(void) const
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
void SetPosition(const Vector &position)
Vector GetPosition(void) const
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
bool IsInitialized(void) const
Check if the object has been initialized.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Hold objects of type Ptr<T>.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...