|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Copyright (C) 2005 Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_NAMTRACE_H 00019 #define __INET_NAMTRACE_H 00020 00021 #include <fstream> 00022 #include <omnetpp.h> 00023 #include "INETDefs.h" 00024 00037 class INET_API NAMTrace : public cSimpleModule 00038 { 00039 protected: 00040 std::ofstream *nams; 00041 00042 int lastnamid; 00043 std::map<int,int> modid2namid; 00044 00045 public: 00046 NAMTrace(); 00047 virtual ~NAMTrace(); 00048 00049 protected: 00050 virtual void initialize(); 00051 virtual void handleMessage(cMessage *msg); 00052 00053 public: 00058 virtual int assignNamId(cModule *node, int namid=-1); 00059 00064 virtual int getNamId(cModule *node) const; 00065 00069 virtual bool isEnabled() const {return nams!=NULL;} 00070 00074 std::ostream& out() {ASSERT(nams!=NULL); return *nams;} 00075 }; 00076 00077 #endif