⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 application.cpp

📁 一个简单的基于静态路由表的最佳路由过程
💻 CPP
字号:
//-------------------------------------------------------------------
//  file name: application.cpp
// 
//    - contains the implementation of application class
//
//-------------------------------------------------------------------


#include "application.h"


// some constant definitions

// message definitions



void application::initialize()
{
}

void application::finish()
{
}

void application::handleMessage(cMessage *msg)
{
	//msg->addPar("senderPX")=this->parentModule()->par("PX");
	//msg->addPar("senderPY")=this->parentModule()->par("PY");
       //msg->addPar("senderId")=ID;
       //msg->addPar("destination")=msg->par("IPd");
       int IPd=(int)msg->par("IPd");
       //int px=(int)this->parentModule()->par("PX");
       //int py=(int)this->parentModule()->par("PY");
	switch(msg->kind())
	{
	/*case M_LOWHIGH:
		{
                           //this->parentModule()->par("mark")=1;
                           UPDATECOLOR(3);
                           //ev<<"%d"<<ID;
                          						
	send(msg,"lowergate_out");
				//delete msg;
				break;				
			//}			
		}*/

	case M_SELF:
		{
			if(strcmp(msg->name(),"Start")==0)
                    {
                      //this->parentModule()->par("mark")=1;
                      UPDATECOLOR(3);	
                      	cMessage *msg = new cMessage("linknode");
	msg->setKind(M_HIGHLOW);								
	msg->addPar("senderPX")=this->parentModule()->par("PX");
	msg->addPar("senderPY")=this->parentModule()->par("PY");
	//msg->addPar("senderGX")=this->parentModule()->par("GX");
	//msg->addPar("senderGY")=this->parentModule()->par("GY");
       msg->addPar("IPd")=IPd;								
	send(msg,"lowergate_out");
                      //delete msg;
			}
			
                   break;
		}
		//break;
	default:
             {
                ev << "unknown message received\n";
		  endSimulation();
                 delete msg;

              }
       }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -