22#include "ns3/pointer.h"
23#include "ns3/simulator.h"
36 TypeId(
"ns3::HierarchicalMobilityModel")
38 .SetGroupName(
"Mobility")
40 .AddAttribute(
"Child",
41 "The child mobility model.",
45 MakePointerChecker<MobilityModel>())
46 .AddAttribute(
"Parent",
47 "The parent mobility model.",
51 MakePointerChecker<MobilityModel>());
142 return Vector(parentPosition.x + childPosition.x,
143 parentPosition.y + childPosition.y,
144 parentPosition.z + childPosition.z);
160 Vector childPosition(position.x - parentPosition.x,
161 position.y - parentPosition.y,
162 position.z - parentPosition.z);
178 Vector speed(parentSpeed.x + childSpeed.x,
179 parentSpeed.y + childSpeed.y,
180 parentSpeed.z + childSpeed.z);
216 int64_t streamsAllocated = 0;
219 return streamsAllocated;
Hierarchical mobility model.
Ptr< MobilityModel > m_child
pointer to child mobility model
Ptr< MobilityModel > GetChild() const
Vector DoGetVelocity() const override
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 DoSetPosition(const Vector &position) override
void SetParent(Ptr< MobilityModel > model)
Sets the parent mobility model to a new one, possibly replacing an existing one.
HierarchicalMobilityModel()
Vector DoGetPosition() const override
static TypeId GetTypeId()
Register this type with the TypeId system.
Ptr< MobilityModel > GetParent() const
void DoInitialize() override
Initialize() implementation.
void SetChild(Ptr< MobilityModel > model)
Sets the child mobility model to a new one, possibly replacing an existing one.
void ParentChanged(Ptr< const MobilityModel > model)
Callback for when parent mobility model course change occurs.
int64_t DoAssignStreams(int64_t) override
The default implementation does nothing but return the passed-in parameter.
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.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Vector GetVelocity() const
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...
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.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
bool IsInitialized() const
Check if the object has been initialized.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
#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, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...