OMNeT++ Simulation Library
6.0.3
|
#include <ceventheap.h>
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.
Public Member Functions | |
Constructors, destructor, assignment | |
cEventHeap (const cEventHeap &msgq) | |
cEventHeap (const char *name=nullptr, int initialCapacity=128) | |
virtual | ~cEventHeap () |
cEventHeap & | operator= (const cEventHeap &other) |
Redefined cObject member functions. | |
virtual cEventHeap * | dup () const override |
virtual std::string | str () const override |
virtual void | forEachChild (cVisitor *v) override |
Simulation-related operations. | |
virtual void | insert (cEvent *event) override |
virtual cEvent * | peekFirst () const override |
virtual cEvent * | removeFirst () override |
virtual void | putBackFirst (cEvent *event) override |
virtual cEvent * | remove (cEvent *event) override |
virtual bool | isEmpty () const override |
virtual void | clear () override |
Random access. | |
virtual int | getLength () const override |
virtual cEvent * | get (int k) override |
virtual void | sort () override |
Public Member Functions inherited from cFutureEventSet | |
cFutureEventSet (const char *name=nullptr) | |
virtual | ~cFutureEventSet () |
cFutureEventSet & | operator= (const cFutureEventSet &other) |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual void | parsimPack (cCommBuffer *buffer) const override |
virtual void | parsimUnpack (cCommBuffer *buffer) override |
virtual cObject * | getOwner () 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 () |
cNamedObject & | operator= (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 cObject * | getThisPtr () const |
virtual std::ostream & | printOn (std::ostream &os) const |
virtual bool | isSoftOwner () const |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
cEventHeap | ( | const cEventHeap & | msgq | ) |
Copy constructor.
cEventHeap | ( | const char * | name = nullptr , |
int | initialCapacity = 128 |
||
) |
Constructor.
|
virtual |
Destructor.
cEventHeap& operator= | ( | const cEventHeap & | other | ) |
Assignment operator. The name member is not copied; see cOwnedObject's operator=() for more details.
|
inlineoverridevirtual |
|
overridevirtual |
Produces a one-line description of the object's contents. See cObject for more details.
Reimplemented from cFutureEventSet.
|
overridevirtual |
|
overridevirtual |
Insert an event into the FES.
Implements cFutureEventSet.
|
overridevirtual |
Peek the first event in the FES (the one with the smallest timestamp.) If the FES is empty, it returns nullptr.
Implements cFutureEventSet.
|
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.
|
overridevirtual |
Undo for removeFirst(): it puts back an event to the front of the FES.
Implements cFutureEventSet.
Removes and returns the given event in the FES. If the event is not in the FES, returns nullptr.
Implements cFutureEventSet.
|
inlineoverridevirtual |
Returns true if the FES is empty.
Implements cFutureEventSet.
|
overridevirtual |
Deletes all events in the FES.
Implements cFutureEventSet.
|
inlineoverridevirtual |
Returns the number of events in the FES.
Implements cFutureEventSet.
|
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.
|
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.