NicEntryDirect.cc

00001 /* -*- mode:c++ -*- ********************************************************
00002  * file:        NicEntryDirect.cc
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  *              ConnectionManager module
00020  **************************************************************************/
00021 
00022 
00023 #include "NicEntryDirect.h"
00024 #include "ChannelAccess.h"
00025 
00026 #ifndef nicEV
00027 #define nicEV (ev.isDisabled()||!coreDebug) ? ev : ev << "NicEntry: "
00028 #endif
00029 
00030 
00031 
00032 void NicEntryDirect::connectTo(NicEntry* other)
00033 {
00034     cModule* otherPtr = other->nicPtr;
00035 
00036     nicEV <<"connecting nic #"<<nicId<< " and #"<<other->nicId<<endl;
00037 
00038     cGate *radioGate=NULL;
00039     if( (radioGate = otherPtr->gate("radioIn")) == NULL )
00040     throw cRuntimeError("Nic has no radioIn gate!");
00041 
00042     outConns[other] = radioGate->getPathStartGate();
00043 }
00044 
00045 
00046 void NicEntryDirect::disconnectFrom(NicEntry* other)
00047 {
00048     nicEV <<"disconnecting nic #"<<nicId<< " and #"<<other->nicId<<endl;
00049     outConns.erase(other);
00050 }