'Understanding .msg files in omnet++ and veins

I am really new to Omnet++ and Veins .I find it really hard to progress through Omnet++ and Veins even with all the documentations provided .Right now I am stuck at how .msg files are generated and how messages are handled in veins .Can someone please help me with some documentation/tutorials/pointers to really understand these concepts .It would really help me out a lot as I am trying to learn this on my own which as of now is a really daunting task for me. Thanks in advance



Solution 1:[1]

In OMNeT++ .msg files are not generated, they are created by a developer.
Let's assume that one need a message that contains two fields: destination address (an integer) and sequence number (an integer). Let's name this type FooMessage. One creates a new file called FooMessage.msg with the following content:

// FooMessage.msg
message FooMessage {
  int destAddress;
  int seqNumber;
}

During building of this project two new files are automatically created: FooMessage_m.h and FooMessage_m.cc. They contain C++ class for the message as well as all setters and getters methods.
To use them one should write in own C++ code something like that:

#include "FooMessage_m.h"

FooMessage *msg = new FooMessage("First message");
msg->setDestAddress(230);
msg->setSeqNumber(1);

TicToc Tutorial contains more advance example. Moreover, OMNeT++ Simulation Manual, Section 6 describes process of message definition.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jerzy D.