Provides several utilities (mainly Blackboard functionality for a host). More...
#include <BaseUtility.h>
Inherits Blackboard, and ImNotifiable.
Public Member Functions | |
virtual void | initialize (int) |
Initializes mobility model parameters. | |
const Coord * | getPos () |
Get current position. | |
const HostState & | getHostState () |
Get the current HostState. | |
virtual void | receiveBBItem (int category, const BBItem *details, int scopeModuleId) |
Receive Moves and HostStates from BaseUtility to synchronize hostPosition and -state. | |
Protected Member Functions | |
cModule * | findHost (void) |
Function to get a pointer to the host module. | |
std::string | logName (void) |
Function to get the logging name of the host. | |
Protected Attributes | |
int | catMove |
BBItem category number of Move. | |
int | catHostState |
BBItem category number of HostState. | |
HostState | hostState |
The hosts current state. | |
Private Attributes | |
Coord | pos |
Provides several utilities (mainly Blackboard functionality for a host).
This file has been merged from BaseUtility.h and Blackboard.h in order to bring Blackboard's functionality to BaseUtility.
Blackboard's comments have been copied since they describe the migrated functionality.
Definition at line 34 of file BaseUtility.h.
const HostState& BaseUtility::getHostState | ( | ) | [inline] |
Get the current HostState.
NOTE: The correct host state is available from initialization-stage 1.
Definition at line 87 of file BaseUtility.h.
References hostState.
Referenced by PhyLayerUWBIR::handleAirFrame(), PhyLayerBattery::handleAirFrame(), and PhyLayerBattery::handleUpperMessage().
{ return hostState; }
const Coord* BaseUtility::getPos | ( | ) | [inline] |
Get current position.
NOTE: This method can't provide the correct host position during initialization, but only after initialization.
A module which needs the position during initialization can instead subscribe to the BBItem-category for 'Move' in order to receive position information during the initialization.
Definition at line 81 of file BaseUtility.h.
References pos.
{return &pos;}
std::string BaseUtility::logName | ( | void | ) | [protected] |
Function to get the logging name of the host.
The logging name is the ned module name of the host (unless the host ned variable loggingName is specified). It can be used for logging messages to simplify debugging in TKEnv.
Definition at line 54 of file BaseUtility.cc.
References findHost().
{ std::ostringstream ost; cModule *parent = findHost(); parent->hasPar("logName") ? ost << parent->par("logName").stringValue() : ost << parent->getName(); ost << "[" << parent->getIndex() << "]"; return ost.str(); }
Coord BaseUtility::pos [private] |
The position of the Host. This coordinate is synchronized with BaseMobility.
Definition at line 42 of file BaseUtility.h.
Referenced by getPos(), and receiveBBItem().