|
INET Framework for OMNeT++/OMNEST
|
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 <omnetpp.h> 00026 #include "NotificationBoard.h" 00027 #include "NotifierConsts.h" 00028 00029 #ifndef EV 00030 #define EV (ev.isDisabled()||!debug) ? (std::ostream&)ev : ev << logName() << "::" << getClassName() << ": " 00031 #endif 00032 00033 00053 class INET_API BasicModule: public cSimpleModule, public INotifiable 00054 { 00055 protected: 00057 NotificationBoard *nb; 00058 00060 bool coreDebug; 00061 00063 bool debug; 00064 00066 std::string loggingName; 00067 00068 protected: 00070 virtual cModule *findHost(void) const; 00071 00073 const char* getLogName(int); 00074 00075 protected: 00077 virtual void initialize(int); 00078 00088 virtual int numInitStages() const {return 2;} 00089 00097 const char* logName(void) const 00098 { 00099 return loggingName.c_str(); 00100 }; 00101 00106 virtual void receiveChangeNotification(int category, const cPolymorphic *details) {} 00107 }; 00108 00109 #endif 00110 00111