OMNET++ QUEUE LENGTH
OMNET++ QUEUE LENGTH class for objects derived from cObject.The default behavior of cQueue is a FIFO: you insert elements at the back using insert(), and remove them at the front using pop(). cQueue may be set up to act as a priority queue. This OMNET++ QUEUE LENGTH requires the user to supply a comparison function.
Constructors and destructors in Queue:
- Constructor:
When comparison function argument is NULL, the queue will act as FIFO, otherwise as priority queue.
cQueue::cQueue | ( | const cQueue & | queue | ) |
- Copy constructor:
Contained objects that are owned by the queue will be duplicated so that the new queue will have its own copy of them.
virtual cQueue::~cQueue | ( | ) | [virtual] |
- Destructor:
Deletes all contained objects that were owned by it.
Sample code for Queue:
[code lang="js"] network RingQueue { parameters: @display("i=device/lan-ring"); submodules: source1: Source { @display("p=370.0,36.0"); } source: Source { @display("p=54.0,45.0"); } queue: Queue { @display("p=110.0,124.0"); } queue1: Queue { @display("p=139.0,241.0"); } queue2: Queue { @display("p=282.0,251.0"); } queue3: Queue { @display("p=327.0,134.0"); } queue4: Queue { @display("p=232.0,64.0"); } connections: queue4.out --> queue.in++; queue.out --> queue1.in++; queue1.out --> queue2.in++; queue2.out --> queue3.in++; queue3.out --> queue4.in++; source.out --> queue.in++; source1.out --> queue3.in++; } [/code]