zebck
zebck

Reputation: 334

Object pointer in .msg file

I am currently implementing a scheduler for which I need more information on each frame than the message and its standard headers carry. I created an Object containing all the information and now I want to add a pointer to a .msg file pointing to the informatino object. The .msg File is used to tag the information to the frame later on.

For this I have created a new message file.

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;  
}

Unfortunately INET v4.1.2 does not allow adding pointers out of the box. That is why I tried to cas my pointer and add an intptr_t by including <cstdint> instead. However, when doing so I am confronted with this error:

Error: unknown type 'intptr_t' for field 'streamFilterID' in 'FilterTag'

It seems like my import doesn't work as I thought. How would I manage to make my .msg file recognize the intptr_t ? Ss there a better way to get done what I am trying to do?

Upvotes: 0

Views: 177

Answers (1)

Jerzy D.
Jerzy D.

Reputation: 7002

Add the following line into your message definition:

class noncobject intptr_t;

It tells the message compiler that intptr_t is an external type.

Upvotes: 1

Related Questions