11#include "ns3/pointer.h" 
   12#include "ns3/simulator.h" 
   25        TypeId(
"ns3::HierarchicalMobilityModel")
 
   27            .SetGroupName(
"Mobility")
 
   29            .AddAttribute(
"Child",
 
   30                          "The child mobility model.",
 
   35            .AddAttribute(
"Parent",
 
   36                          "The parent mobility model.",
 
 
   61        m_child->TraceDisconnectWithoutContext(
 
   66    m_child->TraceConnectWithoutContext(
 
 
   91        m_parent->TraceDisconnectWithoutContext(
 
   98        m_parent->TraceConnectWithoutContext(
 
 
  129    Vector parentPosition = 
m_parent->GetPosition();
 
  130    Vector childPosition = 
m_child->GetPositionWithReference(parentPosition);
 
  131    return Vector(parentPosition.x + childPosition.x,
 
  132                  parentPosition.y + childPosition.y,
 
  133                  parentPosition.z + childPosition.z);
 
 
  148        Vector parentPosition = 
m_parent->GetPosition();
 
  149        Vector childPosition(position.x - parentPosition.x,
 
  150                             position.y - parentPosition.y,
 
  151                             position.z - parentPosition.z);
 
  152        m_child->SetPosition(childPosition);
 
  156        m_child->SetPosition(position);
 
 
  165        Vector parentSpeed = 
m_parent->GetVelocity();
 
  166        Vector childSpeed = 
m_child->GetVelocity();
 
  167        Vector speed(parentSpeed.x + childSpeed.x,
 
  168                     parentSpeed.y + childSpeed.y,
 
  169                     parentSpeed.z + childSpeed.z);
 
 
  205    int64_t streamsAllocated = 0;
 
  206    streamsAllocated += 
m_parent->AssignStreams(stream);
 
  207    streamsAllocated += 
m_child->AssignStreams(stream + streamsAllocated);
 
  208    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 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...
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)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#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...