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

📄 txc2.cpp

📁 这是一个基于OMNeT++的仿真模型,编程语采用C
💻 CPP
字号:
#include <string.h>
#include <omnetpp.h>


class Txc2 : public cSimpleModule
{
  protected:
    virtual void initialize();
    virtual void handleMessage(cMessage *msg);
};

Define_Module(Txc2);

void Txc2::initialize()
{
    if (strcmp("tic", name()) == 0)
    {
        // The `ev' object works like `cout' in C++.
        ev << "Sending initial message\n";
        cMessage *msg = new cMessage("tictocMsg");
        send(msg, "out");
    }
}

void Txc2::handleMessage(cMessage *msg)
{
    // msg->name() is name of the msg object, here it will be "tictocMsg".
    ev << "Received message `" << msg->name() << "', sending it out again\n";
    send(msg, "out");
}

⌨️ 快捷键说明

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