.msg 文件中的对象指针

问题描述

我目前正在实施一个调度程序,我需要关于每个帧的更多信息,而不是消息及其标准标头所携带的信息。我创建了一个包含所有信息的对象,现在我想添加一个指向 .msg 文件的指针,指向 informatino 对象。 .msg 文件用于稍后将信息标记到框架中。

为此,我创建了一个新的消息文件

cplusplus{{
#include "inet/common/TagBase_m.h"
#include <cstdint>
}}

class noncobject inet::TagBase;

namespace nesting;

class FilterTag extends inet::TagBase
{
    intptr_t streamFilterID; 
    simtime_t etT; 
    simtime_t startTime; 
    simtime_t endTime;  
}

不幸的是,INET v4.1.2 不允许添加开箱即用的指针。这就是为什么我试图通过包含 intptr_t 来转换我的指针并添加一个 <cstdint>。但是,这样做时我遇到了这个错误

错误:字段“streamFilterID”的未知类型“intptr_t” '过滤标签'

我的导入似乎不像我想的那样工作。我将如何设法让我的 .msg 文件识别 intptr_t ?有没有更好的方法来完成我正在尝试做的事情?

解决方法

将以下行添加到您的消息定义中:

class noncobject intptr_t;

它告诉消息编译器 intptr_t 是一个外部类型。