Show a struct or class info at the moment on Qtenv

18 views
Skip to first unread message

João Patrício

unread,
Jun 13, 2019, 8:33:15 PM6/13/19
to OMNeT++ Users
Hello,
I have a network of several hosts, each host has inside a c++, header and ned file for its app layer, routing, adapter layer and radio. On Qtenv I can see the current state of variables of these files that are declared on their ned files. But I also want to see from here (for each node at current time of simulation) a struct that I have and their elements (eg. a list of neighbours) (similar to what we see for each node's coordinates position when using mobility). Any tip on how to do this?
I hope I was clear about my doubt, if not I can elaborate more.

I leave here an image for the mobility example, where I can see the constrainAreaMin elements. If a created a class or struct inside the forwarding part, how could I also visualize it there in real time?

dd2.png


Alfonso Ariza Quintana

unread,
Jun 14, 2019, 3:35:12 AM6/14/19
to omn...@googlegroups.com
You need to overload the operator <<

This is the example for interface entry, first interface entry overload the method str(), and later it overloads the operator '<<'

std::ostream& operator<<(std::ostream& os, const InterfaceEntry& e)
{
    os << e.str();
    return os;
};

with this, you can show the data in the Qt ide


De: omn...@googlegroups.com <omn...@googlegroups.com> en nombre de João Patrício <castanheir...@gmail.com>
Enviado: viernes, 14 de junio de 2019 2:33
Para: OMNeT++ Users
Asunto: [Omnetpp-l] Show a struct or class info at the moment on Qtenv
 
--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
To view this discussion on the web visit https://groups.google.com/d/msgid/omnetpp/a878d651-f9da-41fe-9a30-fb66a462113d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attila Török

unread,
Jun 14, 2019, 5:08:27 AM6/14/19
to OMNeT++ Users
Just a side note: Please be aware that the values you see on the very bottom of the attached screenshot are most likely garbage, due to a known bug regarding WATCH-ing structs: https://github.com/omnetpp/omnetpp/issues/727
Attila

João Patrício

unread,
Jun 14, 2019, 7:51:11 PM6/14/19
to OMNeT++ Users
Thank you for your response.
I have added that function but nothing appears.
So I just add this function at the end of the file? Should I call it anywhere else?


sexta-feira, 14 de Junho de 2019 às 10:08:27 UTC+1, Attila Török escreveu:
Just a side note: Please be aware that the values you see on the very bottom of the attached screenshot are most likely garbage, due to a known bug regarding WATCH-ing structs: https://github.com/omnetpp/omnetpp/issues/727
Attila

On Fri, Jun 14, 2019 at 9:35 AM Alfonso Ariza Quintana <aari...@hotmail.com> wrote:
You need to overload the operator <<

This is the example for interface entry, first interface entry overload the method str(), and later it overloads the operator '<<'

std::ostream& operator<<(std::ostream& os, const InterfaceEntry& e)
{
    os << e.str();
    return os;
};

with this, you can show the data in the Qt ide


De: omn...@googlegroups.com <omn...@googlegroups.com> en nombre de João Patrício <castanheir...@gmail.com>
Enviado: viernes, 14 de junio de 2019 2:33
Para: OMNeT++ Users
Asunto: [Omnetpp-l] Show a struct or class info at the moment on Qtenv
 
Hello,
I have a network of several hosts, each host has inside a c++, header and ned file for its app layer, routing, adapter layer and radio. On Qtenv I can see the current state of variables of these files that are declared on their ned files. But I also want to see from here (for each node at current time of simulation) a struct that I have and their elements (eg. a list of neighbours) (similar to what we see for each node's coordinates position when using mobility). Any tip on how to do this?
I hope I was clear about my doubt, if not I can elaborate more.

I leave here an image for the mobility example, where I can see the constrainAreaMin elements. If a created a class or struct inside the forwarding part, how could I also visualize it there in real time?

dd2.png


--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omn...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omn...@googlegroups.com.

João Patrício

unread,
Jun 14, 2019, 8:06:30 PM6/14/19
to OMNeT++ Users
I read something of calling "WATCH" during iniatialization  https://omnetpp.org/news/2004/03/11/sp-1534730906.html

sábado, 15 de Junho de 2019 às 00:51:11 UTC+1, João Patrício escreveu:
Thank you for your response.I

João Patrício

unread,
Jun 14, 2019, 8:18:13 PM6/14/19
to OMNeT++ Users
So from all these infos, I came across omnetManualLink where in 7.10 it explains how to do what I was looking for.
I am going to try it out, did some basic tests and it worked as expected.

Thank you all for your help!
Reply all
Reply to author
Forward
0 new messages