Message Inheritance in OMNeT++ 4.1

The message inheritance mechanism described in the OMNeT++ user guide does not work (as least it is not the case for me).

In section 5.2.4 of the use guide it said that if I want to extend an existing message, I can simply use theextends keyword in the message definition:

message ParentMsg { ... }


then

message SonMsg extends ParentMsg { ... }
Unfortunately, the sonMsg won’t generate its corresponding sonmsg_m files.

I then tried the more general method mentioned later in the same doc which concerns inheriting from arbitrary classes. It turned out that this method works for packets too.

Therefore the message definition should be written like this:

cplusplus {{
#include "parentMsg_m.h"
}}
message ParentMsg // declare the message for later use.
message SonMsg extends ParentMsg{ ... };

Comments & Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>