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

BasicModule.h

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        BasicModule.h
00003  *
00004  * author:      Steffen Sroka
00005  *              Andreas Koepke
00006  *
00007  * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at
00008  *              Technische Universitaet Berlin, Germany.
00009  *
00010  *              This program is free software; you can redistribute it
00011  *              and/or modify it under the terms of the GNU General Public
00012  *              License as published by the Free Software Foundation; either
00013  *              version 2 of the License, or (at your option) any later
00014  *              version.
00015  *              For further information see file COPYING
00016  *              in the top level directory
00017  ***************************************************************************
00018  * part of:     framework implementation developed by tkn
00019  **************************************************************************/
00020 
00021 
00022 #ifndef BASIC_MODULE_H
00023 #define BASIC_MODULE_H
00024 
00025 #include <sstream>
00026 #include <omnetpp.h>
00027 #include "Blackboard.h"
00028 
00029 #ifndef EV
00030 #define EV (ev.disabled()||!debug) ? (std::ostream&)ev : ev << logName() << "::" << className() << ": "
00031 #endif
00032 
00033 
00057 class BasicModule: public cSimpleModule, public ImNotifiable
00058 {
00059   protected:
00061     Blackboard *bb;
00062     
00064     bool debug;
00065 
00066   protected:
00068     cModule *findHost(void) const;
00069 
00071     std::string getLogName(int);
00072 
00073   public:
00074     Module_Class_Members( BasicModule, cSimpleModule, 0);
00075 
00077     virtual void initialize(int);
00078 
00088     virtual int numInitStages() const {
00089       return 2;
00090     }
00091 
00099     std::string logName(void) const {
00100         std::ostringstream ost;
00101         cModule *parent = findHost();
00102         parent->hasPar("logName") ?
00103             ost << parent->par("logName").stringValue() : ost << parent->name();
00104         ost << "[" << parent->index() << "]";
00105         return ost.str();
00106     };
00107 
00114     virtual void receiveBBItem(int category, const BBItem *details, int scopeModuleId) {
00115         if(debug) {
00116             Enter_Method("receiveBBItem(\"%s, %i\")", details->info().c_str(), scopeModuleId);
00117         } else {
00118             Enter_Method_Silent();
00119         }
00120     }
00121 };
00122 
00123 #endif
00124 
00125 

Generated on Fri Jan 12 08:29:32 2007 for Mobility Framework by  doxygen 1.4.4