Provides information and utility methods as well as Blackboard functionality for the whole simulation. More...
#include <BaseWorldUtility.h>
Inherits Blackboard.
Inherited by WorldUtilityStats.
Public Member Functions | |
virtual void | initialize (int stage) |
Initializes blackboard. | |
const Coord * | getPgs () |
Returns the playgroundSize. | |
bool | useTorus () |
Returns true if our playground represents a torus (borders are connected). | |
virtual Coord | getRandomPosition () |
Random position somewhere in the playground. | |
bool | use2D () |
Returns true if the world is 2-dimensional. | |
long | getUniqueAirFrameId () |
Returns an Id for an AirFrame, at the moment simply an incremented long-value. | |
Static Public Attributes | |
static const double | speedOfLight = 299792458.0 |
Speed of light. | |
Protected Member Functions | |
virtual void | initializeIfNecessary () |
Initializes all members accessible by other modules. | |
Protected Attributes | |
Coord | playgroundSize |
Size of the area the nodes are in (in meters). | |
bool | useTorusFlag |
Should the playground be treatend as a torus? | |
bool | use2DFlag |
Should the world be 2-dimensional? | |
long | airFrameId |
Provides a unique number for AirFrames per simulation. | |
bool | isInitialized |
Stores if members are already initialized. |
Provides information and utility methods as well as Blackboard functionality for the whole simulation.
Definition at line 34 of file BaseWorldUtility.h.
const Coord* BaseWorldUtility::getPgs | ( | ) | [inline] |
Returns the playgroundSize.
Note: The playground is in the range [0, playground size]. Meaning the upper borders (at pg-size) as well as the lower borders (at 0) are part of the playground.
Definition at line 83 of file BaseWorldUtility.h.
References initializeIfNecessary(), and playgroundSize.
Referenced by BaseMobility::initialize(), BaseConnectionManager::initialize(), PhyLayer::initializeBreakpointPathlossModel(), PhyLayer::initializeSimplePathlossModel(), MoBANLocal::insideWorld(), MoBANCoordinator::isInsideWorld(), MoBANCoordinator::mainProcess(), BaseMobility::playgroundSizeX(), BaseMobility::playgroundSizeY(), and BaseMobility::playgroundSizeZ().
{ initializeIfNecessary(); return &playgroundSize; };
void BaseWorldUtility::initializeIfNecessary | ( | ) | [protected, virtual] |
Initializes all members accessible by other modules.
Called once the first time another module accesses a member or during initialize stage 0 at the latest.
Definition at line 49 of file BaseWorldUtility.cc.
References airFrameId, Coord::getX(), Coord::getY(), Coord::getZ(), isInitialized, playgroundSize, use2DFlag, and useTorusFlag.
Referenced by getPgs(), getRandomPosition(), getUniqueAirFrameId(), initialize(), use2D(), and useTorus().
{ if(isInitialized) return; use2DFlag = par("use2D"); if (use2DFlag) { playgroundSize = Coord(par("playgroundSizeX"), par("playgroundSizeY")); } else { playgroundSize = Coord(par("playgroundSizeX"), par("playgroundSizeY"), par("playgroundSizeZ")); } if(playgroundSize.getX() <= 0) { opp_error("Playground size in X direction is invalid: "\ "(%f). Should be greater zero.", playgroundSize.getX()); } if(playgroundSize.getY() <= 0) { opp_error("Playground size in Y direction is invalid: "\ "(%f). Should be greater zero.", playgroundSize.getY()); } if(!use2DFlag && playgroundSize.getZ() <= 0) { opp_error("Playground size in Z direction is invalid: "\ "(%f). Should be greater zero (or use 2D mode).", playgroundSize.getZ()); } useTorusFlag = par("useTorus"); airFrameId = 0; isInitialized = true; }
Coord BaseWorldUtility::playgroundSize [protected] |
Size of the area the nodes are in (in meters).
Note: The playground is in the range [0, playground size]. Meaning the upper borders (at pg-size) as well as the lower borders (at 0) are part of the playground.
Definition at line 44 of file BaseWorldUtility.h.
Referenced by getPgs(), getRandomPosition(), and initializeIfNecessary().