Priority cQueue

301 views
Skip to first unread message

Mohammad Arouri

unread,
Mar 8, 2010, 5:05:33 PM3/8/10
to omn...@googlegroups.com
Am trying to use the cQueue in Omnet to work as a priority queue,
i added to it messages (the messages is considered as object)

 The criteria of ordering is a variable i keep in the message called SN of type integer.
I try to define the queue as follows:

   cQueue sortedqueue ( "sortedqueue", RLCSDU.getSN() ,true);
where RLCSDU is the message name
but the omnet give me an error i can not correct.

any suggestions please ..
Best Regards

Mohammad Arouri

unread,
Mar 11, 2010, 8:38:02 AM3/11/10
to omn...@googlegroups.com
Am trying to use the cQueue in Omnet to work as a priority queue,
i added messages to it (the messages is considered as object)

Alfonso Ariza

unread,
Mar 11, 2010, 11:09:40 AM3/11/10
to omn...@googlegroups.com

is it necessary to use the cQueue container?

For example, if you are using the std::vector you can use std::sort

--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to omnetpp+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omnetpp?hl=en.

Rudolf Hornig

unread,
Mar 11, 2010, 1:19:33 PM3/11/10
to omn...@googlegroups.com
It is not working that way. Check the API docs.

You must provide the queue name and a pointer to a comaprator function which accepts
two cObjects (in this case these will be messages) and returs which one is greater as an integer (-1,0,1)


Rudolf
 

any suggestions please ..
Best Regards

--
Reply all
Reply to author
Forward
0 new messages