00001 /* -*- mode:c++ -*- ******************************************************** 00002 * file: NicEntry.h 00003 * 00004 * author: Daniel Willkomm 00005 * 00006 * copyright: (C) 2005 Telecommunication Networks Group (TKN) at 00007 * Technische Universitaet Berlin, Germany. 00008 * 00009 * This program is free software; you can redistribute it 00010 * and/or modify it under the terms of the GNU General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2 of the License, or (at your option) any later 00013 * version. 00014 * For further information see file COPYING 00015 * in the top level directory 00016 *************************************************************************** 00017 * part of: framework implementation developed by tkn 00018 * description: Class to store information about a nic for the 00019 * ChannelControl module 00020 **************************************************************************/ 00021 00022 #ifndef NICENTRY_H 00023 #define NICENTRY_H 00024 00025 #include <omnetpp.h> 00026 #include <map> 00027 00028 #include "Coord.h" 00029 00030 00039 class NicEntry : public cPolymorphic 00040 { 00041 public: 00042 typedef std::map<int, cGate*> GateList; 00043 00045 int nicId; 00046 00048 cModule *nicPtr; 00049 00051 int hostId; 00052 00054 Coord pos; 00055 00056 protected: 00058 bool coreDebug; 00059 00067 GateList outConns; 00068 00069 public: 00075 NicEntry(bool debug) : nicId(0), nicPtr(0), hostId(0){ 00076 coreDebug = debug; 00077 }; 00078 00083 virtual ~NicEntry() {} 00084 00086 virtual void connectTo(NicEntry*) = 0; 00087 00089 virtual void disconnectFrom(NicEntry*) = 0; 00090 00092 const GateList& getGateList(){ 00093 return outConns; 00094 } 00095 00097 bool isConnected(const NicEntry* other) { 00098 return (outConns.find(other->nicId) != outConns.end()); 00099 }; 00100 00109 const cGate* getOutGateTo(int to) 00110 { 00111 return outConns[to]; 00112 }; 00113 00114 }; 00115 00116 #endif