Main Page Modules Class Hierarchy Compound List File List Compound Members

# cMessageHeap Class Reference

`#include <cmsgheap.h>`

Inheritance diagram for cMessageHeap::

List of all members.

## Public Methods

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 cObject* | dup () const
virtual void | info (char *buf)
virtual void | forEach (ForeachFunc f)
Container functions.
void | insert (cMessage *event)
cMessage* | peekFirst () const
cMessage* | getFirst ()
cMessage* | get (cMessage *event)
void | sort ()
void | clear ()
int | length () const
bool | empty () const

## Detailed Description

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

See also:
  Iterator

## Constructor & Destructor Documentation

cMessageHeap::cMessageHeap ( | const cMessageHeap & msgq )

| Copy constructor.

cMessageHeap::cMessageHeap ( | const char * name = NULL,
| int size = 128 )

| Constructor.

cMessageHeap::~cMessageHeap ( | )`[virtual]`

| Destructor.

## Member Function Documentation

void cMessageHeap::clear ( | )

| Deletes all messages in the heap.

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

| Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject.

bool cMessageHeap::empty ( | ) const`[inline]`

| Returns true if the heap is empty.

void cMessageHeap::forEach ( | ForeachFunc f )`[virtual]`

| Call the passed function for each contained object. See cObject for more details. Reimplemented from cObject.

cMessage * cMessageHeap::get ( | cMessage * event )

| Remove and return the given message in the heap.

cMessage * cMessageHeap::getFirst ( | )

| Remove and return the first message in the heap (the one with the smallest timestamp.)

void cMessageHeap::info ( | char * buf )`[virtual]`

| Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details. Reimplemented from cObject.

void cMessageHeap::insert ( | cMessage * event )

| Insert a new message into the heap.

int cMessageHeap::length ( | ) const`[inline]`

| Returns the number of messages in the heap.

cMessageHeap & cMessageHeap::operator= ( | const cMessageHeap & msgqueue )

| Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

cMessage * cMessageHeap::peekFirst ( | ) const

| Peek the first message in the heap (the one with the smallest timestamp.)

void cMessageHeap::sort ( | )

| Sort 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:

- cmsgheap.h