我是靠谱客的博主 喜悦小蘑菇,最近开发中收集的这篇文章主要介绍omnet++ tictoc1 实例分析,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

更详细视频教程参考《OMNeT++TicToc案例精讲》https://edu.csdn.net/course/detail/30015

class Txc1 : public cSimpleModule

{

  protected:

    // The following redefined virtual function holds the algorithm.

    virtual void initialize() override;

    virtual void handleMessage(cMessage *msg) override;

};

 

// The module class needs to be registered with OMNeT++

//所有模块实现时,必须添加Define_Module(XXX);

Define_Module(Txc1);

//初始化函数

void Txc1::initialize()

{

    // Am I Tic or Toc?

    //getName当前实例的名称,也就是NED中模块实例的名称

    if (strcmp("tic", getName()) == 0) {

        // create and send first message on gate "out". "tictocMsg" is an

        // arbitrary string which will be the name of the message object.

        //定义消息,消息名称

        cMessage *msg = new cMessage("tictocMsg");

        //消息发送

        send(msg, "out");

    }

}

//消息处理函数

void Txc1::handleMessage(cMessage *msg)

{

    // 消息发送

    send(msg, "out"); // send out the message

}

最后

以上就是喜悦小蘑菇为你收集整理的omnet++ tictoc1 实例分析的全部内容,希望文章能够帮你解决omnet++ tictoc1 实例分析所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(59)

评论列表共有 0 条评论

立即
投稿
返回
顶部