initialization of circular queue in Omnet

I am new to Omnet and am having some difficulty in initializing circular queue. I think this is done in the same way as initialization is done in C++ but I am not so sure. For instance, when I have a variable int numbers. I initialize it by numbers = par("numbers"). Similarly, I have a circular queue cQueue queue. Now, how would I initialize it? I didn't find any useful documentation for this. I want to initialize queue to an empty array. Something like queue=[].

Answers


Sadiksha.

This is not the best place to ask about Omnet++. When you have more doubts, go to https://groups.google.com/forum/?fromgroups#!forum/omnetpp

Either way, I'll try to answer your question ;)

You got some things mixed up. The cQueue class is not a circular queue, but a simple queue for storing pointers to objects of the cObject type. Also, for initializing an empty queue, you just need to declare it, like

cQueue queue("Named Queue"); // creates a named queue

You can then add default objects to your queue using a for loop:

for (int i = 0; i < num; ++i) {
    queue.insert(obj); // get this object somewhere
}

I hope this helps.

Regards


Need Your Help

Android: How to dynamically change inflated tab content?

android android-tabhost layout-inflater

I am having trouble setting the content on a tab that I've inflated from an XML file.

How do I make a batch variable = to a command answer?

batch-file set

I have looked in quite a few places. Maybe I have not asked the right question, but I am now here. I am making a batch file to sense what the Operating system is.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.