Public Member Functions | Protected Member Functions | Protected Attributes

LineSegmentsMobilityBase Class Reference
[mobility - modules handling the mobility of the hosts]

Base class for mobility models where movement consists of a sequence of linear movements of constant speed. More...

#include <LineSegmentsMobilityBase.h>

Inherits BaseMobility.

Inherited by ANSimMobility, BonnMotionMobility, and TurtleMobility.

Collaboration diagram for LineSegmentsMobilityBase:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void initialize (int stage)
 Initializes mobility model parameters.

Protected Member Functions

virtual void handleSelfMsg (cMessage *msg)
 Called upon arrival of a self messages.
virtual void beginNextMove (cMessage *msg)
 Begin new line segment after previous one finished.
virtual void setTargetPosition ()=0
 Should be redefined in subclasses. This method gets called when targetPos and targetTime has been reached, and its task is to set a new targetPos and targetTime. At the end of the movement sequence, it should set targetTime=0.

Protected Attributes

simtime_t targetTime
 end time of current linear movement
Coord targetPos
 end position of current linear movement
Coord stepTarget
parameters to handle the movement of the host

Coord stepSize
 Size of a step.

Detailed Description

Base class for mobility models where movement consists of a sequence of linear movements of constant speed.

Subclasses must redefine setTargetPosition() which is supposed to set a new target position and target time once the previous one is reached.

NOTE: Does not yet support 3-dimensional movement.

Author:
Andras Varga

Definition at line 36 of file LineSegmentsMobilityBase.h.


Member Function Documentation

void LineSegmentsMobilityBase::initialize ( int  stage  )  [virtual]

Initializes mobility model parameters.

Assigns a pointer to ConnectionManager and gets a pointer to its host.

Creates a random position for a host if the position is not given as a parameter in "omnetpp.ini".

Additionally the registration with ConnectionManager is done and it is assured that the position display string tag (p) exists and contains the exact (x) tag.

If the speed of the host is bigger than 0 a first MOVE_HOST self message is scheduled in stage 1

Reimplemented from BaseMobility.

Reimplemented in ANSimMobility, BonnMotionMobility, and TurtleMobility.

Definition at line 23 of file LineSegmentsMobilityBase.cc.

References BaseWorldUtility::use2D(), and BaseMobility::world.

                                                   {
  BaseMobility::initialize(stage);

  if(stage == 1) {
    if(!world->use2D()) {
      opp_warning("This mobility module does not yet support 3-dimensional movement."\
            "Movements will probably be incorrect.");
    }
  }
}


The documentation for this class was generated from the following files: