Inherited by BasicApplLayer, BasicDecider, BasicLayer, BasicMobility, ChannelAccess, SimpleArp, and SingleChannelRadio.
Inheritance diagram for BasicModule:
Public Member Functions
|Module_Class_Members (BasicModule, cSimpleModule, 0)|
|virtual void||initialize (int)|
|Basic initialization for all modules. |
|virtual int||numInitStages () const|
|Divide initialization into two stages. |
|std::string||logName (void) const|
|Function to get the logging name of the host. |
|virtual void||receiveBBItem (int category, const BBItem *details, int scopeModuleId)|
|Called by the Blackboard whenever a change of a category occurs to which we have subscribed. Redefined from ImNotifiable. In this base class just handle the context switching and some debug notifications. |
Protected Member Functions
|cModule *||findHost (void) const|
|Function to get a pointer to the host module. |
|Function to get the logging name of id. |
|Cached pointer to the Blackboard module. |
|Debug switch for all other modules. |
The basic module additionally provides a function findHost which returns a pointer to the host module and a function hostIndex to return the index of the host module. The latter one correspondes to the index shown in tkenv and comes in very handy for testing and debugging using tkenv. It is used e.g. in all the 'print' macros used for debugging.
There is no Define_Module() for this class because we use BasicModule only as a base class to derive all other module. There will never be a stand-alone BasicModule module (and that is why there is no Define_Module() and no .ned file for BasicModule).
Function to get the logging name of id.
This function returns the logging name of the module with the specified id. It can be used for logging messages to simplify debugging in TKEnv.
Only supports ids from simple module derived from the BasicModule or the nic compound module id.
Basic initialization for all modules.
Subscription to Blackboard should be in stage==0, and firing notifications in stage==1 or later.
NOTE: You have to call this in the initialize() function of the inherited class!
Reimplemented in BasicApplLayer, BurstApplLayer, PollApplLayer, TestApplLayer, ANSimMobility, BonnMotionMobility, CircleMobility, ConstSpeedMobility, LinearMobility, MassMobility, RectangleMobility, TurtleMobility, Flood, SimpleNetwLayer, AlohaMacLayer, CSMAMacLayer, Mac80211, Decider80211, GilbertElliotSnr, P2PPhyLayer, SnrDecider, SnrEval, SnrEval80211, SingleChannelRadio, BasicDecider, BasicLayer, BasicMacLayer, BasicMobility, BasicSnrEval, and ChannelAccess.
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.
Divide initialization into two stages.
In the first stage (stage==0), modules subscribe to notification categories at Blackboard. The first notifications (e.g. about the initial values of some variables such as RadioState) should take place earliest in the second stage (stage==1), when everyone interested in them has already subscribed.