OMNeT++ Simulation Library  6.0.3
cEventHeap Class Reference

#include <ceventheap.h>

Description

The default, binary heap based implementation of the future event set.

Using binary heap as the underlying data structure provides reliable performance for most workloads. A worst case for heap is insertion at the front (i.e. for the current simulation time), which is actually quite common, due to the abundance of zero-delay links in models. This case is optimized by employing an additional circular buffer specifically for storing events inserted scheduled for the current simulation time.

Inheritance diagram for cEventHeap:
cFutureEventSet cOwnedObject cNamedObject cObject

Public Member Functions

Constructors, destructor, assignment
 cEventHeap (const cEventHeap &msgq)
 
 cEventHeap (const char *name=nullptr, int initialCapacity=128)
 
virtual ~cEventHeap ()
 
cEventHeapoperator= (const cEventHeap &other)
 
Redefined cObject member functions.
virtual cEventHeapdup () const override
 
virtual std::string str () const override
 
virtual void forEachChild (cVisitor *v) override
 
Simulation-related operations.
virtual void insert (cEvent *event) override
 
virtual cEventpeekFirst () const override
 
virtual cEventremoveFirst () override
 
virtual void putBackFirst (cEvent *event) override
 
virtual cEventremove (cEvent *event) override
 
virtual bool isEmpty () const override
 
virtual void clear () override
 
Random access.
virtual int getLength () const override
 
virtual cEventget (int k) override
 
virtual void sort () override
 
- Public Member Functions inherited from cFutureEventSet
 cFutureEventSet (const char *name=nullptr)
 
virtual ~cFutureEventSet ()
 
cFutureEventSetoperator= (const cFutureEventSet &other)
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)=default
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
virtual std::string getClassAndFullName () const
 
virtual std::string getClassAndFullPath () const
 
const cObjectgetThisPtr () const
 
virtual std::ostream & printOn (std::ostream &os) const
 
virtual bool isSoftOwner () const
 
cObjectfindObject (const char *name, bool deep=true)
 
virtual cClassDescriptorgetDescriptor () const
 
void copyNotSupported () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cSoftOwnergetOwningContext ()
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cEventHeap() [1/2]

cEventHeap ( const cEventHeap msgq)

Copy constructor.

◆ cEventHeap() [2/2]

cEventHeap ( const char *  name = nullptr,
int  initialCapacity = 128 
)

Constructor.

◆ ~cEventHeap()

virtual ~cEventHeap ( )
virtual

Destructor.

Member Function Documentation

◆ operator=()

cEventHeap& operator= ( const cEventHeap other)

Assignment operator. The name member is not copied; see cOwnedObject's operator=() for more details.

◆ dup()

virtual cEventHeap* dup ( ) const
inlineoverridevirtual

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

Reimplemented from cObject.

◆ str()

virtual std::string str ( ) const
overridevirtual

Produces a one-line description of the object's contents. See cObject for more details.

Reimplemented from cFutureEventSet.

◆ forEachChild()

virtual void forEachChild ( cVisitor v)
overridevirtual

Calls v->visit(this) for each contained object. See cObject for more details.

Reimplemented from cObject.

◆ insert()

virtual void insert ( cEvent event)
overridevirtual

Insert an event into the FES.

Implements cFutureEventSet.

◆ peekFirst()

virtual cEvent* peekFirst ( ) const
overridevirtual

Peek the first event in the FES (the one with the smallest timestamp.) If the FES is empty, it returns nullptr.

Implements cFutureEventSet.

◆ removeFirst()

virtual cEvent* removeFirst ( )
overridevirtual

Removes and return the first event in the FES (the one with the smallest timestamp.) If the FES is empty, it returns nullptr.

Implements cFutureEventSet.

◆ putBackFirst()

virtual void putBackFirst ( cEvent event)
overridevirtual

Undo for removeFirst(): it puts back an event to the front of the FES.

Implements cFutureEventSet.

◆ remove()

virtual cEvent* remove ( cEvent event)
overridevirtual

Removes and returns the given event in the FES. If the event is not in the FES, returns nullptr.

Implements cFutureEventSet.

◆ isEmpty()

virtual bool isEmpty ( ) const
inlineoverridevirtual

Returns true if the FES is empty.

Implements cFutureEventSet.

◆ clear()

virtual void clear ( )
overridevirtual

Deletes all events in the FES.

Implements cFutureEventSet.

◆ getLength()

virtual int getLength ( ) const
inlineoverridevirtual

Returns the number of events in the FES.

Implements cFutureEventSet.

◆ get()

virtual cEvent* get ( int  k)
overridevirtual

Returns the kth event in the FES if 0 <= k < getLength(), and nullptr otherwise. Note that iteration does not necessarily return events in increasing timestamp (getArrivalTime()) order unless you called sort() before.

Implements cFutureEventSet.

◆ sort()

virtual void sort ( )
overridevirtual

Sorts the contents of the FES. This is only necessary if one wants to iterate through in the FES in strict timestamp order.

Implements cFutureEventSet.


The documentation for this class was generated from the following file: