Accessing the parameters and functions of nodes in .ned file to .cc file

426 views
Skip to first unread message

Karthick Subramanian

unread,
May 28, 2015, 6:57:44 AM5/28/15
to omn...@googlegroups.com
Hi all,

I have used a DroptailQueue in ned file and want to perform some operation on this queue at.cc file. I dont know how to access this parameters in .cc file.

E.g In ned file I have
submodule:
dropTailQueue1: DropTailQueue {
            @display("p=274,110");
            queueName = "queue1";
        }
And in .cc file I want dequeue the elements from this queue if the queue length is 90. I tried
if(strcmp(getName(),"dropTailQueue2")==0)
{//dequeue operation}
and
if(strcmp(getName(),"queue2")==0)
{//dequeue operation}

but both of these code throws the error. I dont know how to use it. Or I need to declare a queue in the c++ file? If so what happens to the queue used in ned file.

Kindly, provide your inputs.

Regards,
Karthick

Tobias Hardes

unread,
May 28, 2015, 7:10:05 AM5/28/15
to omn...@googlegroups.com
try - par("queueName")  - to get the value of "queueName" in the ned file
--
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.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Karthick Subramanian

unread,
May 28, 2015, 7:23:05 AM5/28/15
to omn...@googlegroups.com, tobias...@autistici.org

Hi Tobias,

I am sorry don't understand how this works. Also I want to dequeue(pop()) the queue. How can I can do that with this parameter option. I want to obtain the real queue that ned file is pointing. Kindly, elaborate your answer.

Michael Kirsche

unread,
May 28, 2015, 8:07:21 AM5/28/15
to omn...@googlegroups.com
Like Tobias wrote, the par Method for cPar Objects (NED parameters) has everything you need.

Take at look at the OMNeT Manual: https://omnetpp.org/doc/omnetpp/manual/usman.html#sec155
It explains everything there is to know...

Karthick Subramanian

unread,
May 28, 2015, 8:23:11 AM5/28/15
to omn...@googlegroups.com
HI Michael,

I think I have used a wrong word "parameter". Actually I want to get the entire queue in the NED file along with the packets in it and do operations on this queue. Can you please suggest how this can be done.

Thanks,
Karthick

Michael Kirsche

unread,
May 28, 2015, 9:45:25 AM5/28/15
to omn...@googlegroups.com
Take a look at OMNeT and INET's examples.
You will need to get a hold of the queueName, find out which model type you are dealing with (via check_and_cast) and then use the public methods of the exact queue type.

An example might be the use of queue in INET's linklayer model for the PPP interface. Take a look at the according NED, header and source files to see how it is done.
Reply all
Reply to author
Forward
0 new messages