Stores the future event set. More...
#include <cmessageheap.h>
Classes | |
class | Iterator |
Walks along a cMessageHeap. More... | |
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 cMessageHeap * | dup () const |
virtual std::string | info () const |
virtual void | forEachChild (cVisitor *v) |
Container functions. | |
void | insert (cMessage *event) |
cMessage * | peekFirst () const |
cMessage * | peek (int m) |
cMessage * | removeFirst () |
cMessage * | remove (cMessage *event) |
void | sort () |
void | clear () |
int | getLength () const |
bool | isEmpty () const |
int | length () const |
bool | empty () const |
Stores the future event set.
The underlying data structure is heap; the array used to store the heap expands as needed.
virtual cMessageHeap* cMessageHeap::dup | ( | ) | const [inline, virtual] |
virtual void cMessageHeap::forEachChild | ( | cVisitor * | v | ) | [virtual] |
virtual std::string cMessageHeap::info | ( | ) | const [virtual] |
cMessageHeap& cMessageHeap::operator= | ( | const cMessageHeap & | msgqueue | ) |
Assignment operator.
The name member is not copied; see cOwnedObject's operator=() for more details.
cMessage* cMessageHeap::peek | ( | int | m | ) |
Returns the mth message in the heap if 0 <= m < getLength(), and NULL otherwise.
Note that iteration does not necessarily return messages in increasing timestamp (getArrivalTime()) order unless you called sort() before.
cMessage* cMessageHeap::peekFirst | ( | ) | const |
Peek the first message in the heap (the one with the smallest timestamp.
) If the heap is empty, it returns NULL.
Removes and returns the given message in the heap.
If the message is not in the heap, returns NULL.
cMessage* cMessageHeap::removeFirst | ( | ) |
Removes and return the first message in the heap (the one with the smallest timestamp.
) If the heap is empty, it returns NULL.
void cMessageHeap::sort | ( | ) |
Sorts the contents of the heap.
This is only necessary if one wants to iterate through in the FES in strict timestamp order.