#include <TwoLevelEventQueue.h>
Public Member Functions | |
TwoLevelQueueBase (const DEBaseSched &pSched) | |
unsigned int | cancelEvent (const SpecialEvent *pEv, int pEventID) |
unsigned int | cancelEvent (const SpecialEvent *pEv, const Type *pData) |
unsigned int | cancelEvent (int pEvID, const Star *pDest) |
double | getTimeOfEvent (const SpecialEvent *pEv, int pEventID) const |
bool | isScheduled (const SpecialEvent *pEv, int pEventID) const |
StringList | printCurrentStack () const |
StringList | printHeap () const |
Protected Types | |
typedef std::vector< SPQEvent * > | cHeap |
Protected Member Functions | |
void | popHeap () |
void | putEventToStack (SPQEvent *pEvent) |
void | putHeap (SPQEvent *pE) |
void | putHeap (Particle *pPa, PortHole *pPh, const double &pL, const double &pFL) |
void | putHeap (Pointer pP, const double &pL, const double &pFL) |
Protected Attributes | |
long | mCurrentEventNumber |
cStore | mCurrentStack |
cStore | mGarbageCollect |
cHeap | mHeap |
unsigned int | mNextInputPos |
const DEBaseSched & | mSched |
Friends | |
class | DEPriorityFreeScheduler |
BasePrioQueue interface that has to be redefined | |
void | pushHead (Particle *p, PortHole *ph, double v, double fv)=0 |
void | pushTail (Particle *p, PortHole *ph, double v, double fv)=0 |
virtual LevelLink * | levelput (Pointer a, double v, double fv)=0 |
virtual LevelLink * | levelputSE (Pointer a, double v, double fv)=0 |
Basic priority queue operations | |
void | initialize () |
bool | empty () const |
int | size () const |
const SPQEvent * | top () const |
Operations on the heap | |
SPQEvent * | heapTop () const |
const bool | heapEmpty () const |
const int | heapSize () const |
Interface for mainpulating the currentStack | |
typedef std::deque< SPQEvent * > | cStore |
typedef cStore::iterator | cStackIter |
void | moveCurrentToStack (double pCurrentTime) |
const SPQEvent * | getCurrentStackFront () const |
void | popCurrentStack () |
bool | stackEmpty () const |
int | stackSize () const |
const SPQEvent * | stackFront () const |
cStore::iterator | stackBegin () |
cStore::iterator | stackEnd () |
cStackIter | eraseFromStack (cStackIter pToDel) |
Dynamic instantiation support | |
int | deleteEventsForStar (const Star *pStar) |
int | deleteEventsForPort (const PortHole *pPort) |
memory management | |
SPQEvent * | getFreeLink () |
void | putFreeLink (SPQEvent *pLink) |
Base class for event queue structures based on two distinct data structures
|
protected |
heap structure for efficient management of future events
int TwoLevelQueueBase< cCompare >::deleteEventsForPort | ( | const PortHole * | pPort | ) |
Discard all events destined for a given input port.
pPort | destination port of the events to delete |
int TwoLevelQueueBase< cCompare >::deleteEventsForStar | ( | const Star * | pStar | ) |
Clear all events destined for a given star. message events are discarded as well as process events.
pStar |
|
inline |
Return whether the structure is empty.
TwoLevelQueueBase< cCompare >::cStackIter TwoLevelQueueBase< cCompare >::eraseFromStack | ( | cStackIter | pToDel | ) |
Remove the element the iterator points to.
|
inline |
Return a const pointer to the first element in the current event stack.
|
inline |
Retrieve a new SPQEvent object. Takes it either from the list of free links or creates a new one.
|
inline |
Return a reference to the element with the highest priority It must be assured that the queue is not empty
void TwoLevelQueueBase< cCompare >::initialize | ( | ) |
Initialize the structure and clear all contained entries.
|
pure virtual |
Put a pointer into the eventQ
Implemented in TwoLevelEventQueuePrioritized, and TwoLevelEventQueuePriorityFree.
void TwoLevelQueueBase< cCompare >::moveCurrentToStack | ( | double | pCurrentTime | ) |
Move all particle with the time stamp pCurrentTime to the current event stack
|
inline |
Remove the foremost element from the current event stack.
|
inlineprotected |
Remove the foremost element from the heap
|
pure virtual |
Contruct and insert a message event into the event queue structure.
p | The message particle |
ph | destination porthole |
v | timestamp of th message |
fv | finelevel (priority). This value has to be supplied, but is ignored by the associated scheduler. |
Implemented in TwoLevelEventQueuePrioritized, and TwoLevelEventQueuePriorityFree.
|
pure virtual |
Contruct and insert a message event into the event queue structure.
p | The message particle |
ph | destination porthole |
v | timestamp of th message |
fv | finelevel (priority). This value has to be supplied, but is ignored by the associated scheduler. |
Implemented in TwoLevelEventQueuePrioritized, and TwoLevelEventQueuePriorityFree.
|
protected |
Insert an event into the stack of current events. Maintains the specific ordering of events
Insert an event into the stack of current events.
|
inline |
Put a unused link into the list of free links.
|
inlineprotected |
Insert an event into the heap structure
|
protected |
Create an event link with the given parameters and insert it to the heap.
|
protected |
Create an event link with the given parameters and insert it to the heap.
|
inline |
Return the number of contained elements.
|
inline |
Get an iterator to the first element in the stack.
|
inline |
Check if the stack structure contains entries.
|
inline |
Get an iterator to the end of the stack structure
|
inline |
Retrieve the foremost element of the stack structure.
|
inline |
Size of the stack structure.
|
inline |
Return a reference to the element with the highest priority
|
protected |
Total number of inserted events in this simulation run. Used to achieve correct ordering of inserted events.
|
protected |
linear searchable structure containing all events at the current timestamp. This member is public because
|
protected |
Manage unused Links
|
protected |
reference to the associated scheduler