#include <cmsgheap.h>
Inheritance diagram for cMessageHeap:
The underlying data structure is heap; the array used to store the heap expands as needed.
Public Member Functions | |
Constructors, destructor, assignment | |
cMessageHeap (const cMessageHeap &msgq) | |
cMessageHeap (const char *name=NULL, int size=128) | |
virtual | ~cMessageHeap () |
cMessageHeap & | operator= (const cMessageHeap &msgqueue) |
Redefined cObject member functions. | |
virtual cPolymorphic * | dup () const |
virtual std::string | info () const |
virtual void | forEachChild (cVisitor *v) |
Container functions. | |
void | insert (cMessage *event) |
cMessage * | peekFirst () const |
cMessage * | getFirst () |
cMessage * | get (cMessage *event) |
cMessage * | peek (int m) |
void | sort () |
void | clear () |
int | length () const |
bool | empty () const |
Classes | |
class | Iterator |
Walks along a cMessageHeap. More... |
|
Copy constructor.
|
|
Constructor.
|
|
Destructor.
|
|
Deletes all messages in the heap.
|
|
Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject. |
|
Returns true if the heap is empty.
|
|
Calls v->visit(this) for each contained object. See cObject for more details. Reimplemented from cObject. |
|
Removes and returns the given message in the heap. If the message is not in the heap, returns NULL. |
|
Removes and return the first message in the heap (the one with the smallest timestamp. ) If the heap is empty, it returns NULL. |
|
Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cPolymorphic. |
|
Insert a new message into the heap.
|
|
Returns the number of messages in the heap.
|
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. |
|
Returns the mth message in the heap if 0 <= m < length(), and NULL otherwise. Note that iteration does not necessarily return messages in increasing timestamp (arrivalTime()) order unless you called sort() before. |
|
Peek the first message in the heap (the one with the smallest timestamp. ) If the heap is empty, it returns NULL. |
|
Sorts the contents of the heap. This is only necessary if one wants to iterate through in the FES in strict timestamp order. |