cMessageHeap Class Reference
[Internal classes]

Stores the future event set. More...

#include <cmessageheap.h>

Inheritance diagram for cMessageHeap:
cOwnedObject cNamedObject cObject

List of all members.

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 ()
cMessageHeapoperator= (const cMessageHeap &msgqueue)
Redefined cObject member functions.

virtual cMessageHeapdup () const
virtual std::string info () const
virtual void forEachChild (cVisitor *v)
Container functions.

void insert (cMessage *event)
cMessagepeekFirst () const
cMessagepeek (int m)
cMessageremoveFirst ()
cMessageremove (cMessage *event)
void sort ()
void clear ()
int getLength () const
bool isEmpty () const
int length () const
bool empty () const

Detailed Description

Stores the future event set.

The underlying data structure is heap; the array used to store the heap expands as needed.

See also:
Iterator

Member Function Documentation

virtual cMessageHeap* cMessageHeap::dup (  )  const [inline, virtual]

Creates and returns an exact copy of this object.

See cObject for more details.

Reimplemented from cObject.

virtual void cMessageHeap::forEachChild ( cVisitor v  )  [virtual]

Calls v->visit(this) for each contained object.

See cObject for more details.

Reimplemented from cObject.

virtual std::string cMessageHeap::info (  )  const [virtual]

Produces a one-line description of the object's contents.

See cObject for more details.

Reimplemented from cObject.

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.

cMessage* cMessageHeap::remove ( cMessage event  ) 

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.


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:29 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3