Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

BasicModule Class Reference
[basicModules - basic module classes of the MF]

Base class for all simple modules of a host that want to have access to the Blackboard module. More...

#include <BasicModule.h>

Inherits ImNotifiable.

Inherited by BasicApplLayer, BasicDecider, BasicLayer, BasicMobility, ChannelAccess, SimpleArp, and SingleChannelRadio.

Inheritance diagram for BasicModule:

Inheritance graph
Collaboration diagram for BasicModule:

Collaboration graph
List of all members.

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.
std::string getLogName (int)
 Function to get the logging name of id.

Protected Attributes

 Cached pointer to the Blackboard module.
bool debug
 Debug switch for all other modules.

Detailed Description

Base class for all simple modules of a host that want to have access to the Blackboard module.

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).

See also:
Steffen Sroka

Andreas Koepke

Member Function Documentation

std::string BasicModule::getLogName int  id  )  [protected]

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.

id Id of the module for the desired logging name
logging name of module id or NULL if not found
See also:

void BasicModule::initialize int  stage  )  [virtual]

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.

std::string BasicModule::logName void   )  const [inline]

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.

virtual int BasicModule::numInitStages  )  const [inline, virtual]

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.

The documentation for this class was generated from the following files:
Generated on Fri Jan 12 08:29:42 2007 for Mobility Framework by  doxygen 1.4.4