EventRecvTimeLocalTieBrkCmp is used to compare two events and break ties when the receiving time of two events is the same. More...
#include <Event.h>
Public Member Functions | |
int | compare (const EventTy &left, const EventTy &right) const |
Compares two events 'left' and 'right' based on getRecvTime(). | |
bool | operator() (const EventTy &left, const EventTy &right) const |
returns true if left > right Since std::priority_queue is a max heap, we use > semantics instead of < in order to get a min heap and thus process events in increasing order of recvTime. |
EventRecvTimeLocalTieBrkCmp is used to compare two events and break ties when the receiving time of two events is the same.
Ties between events with same recvTime need to be borken consistently, i.e. compare(m,n) and compare (n,m) are consistent with each other during the life of events 'm' and 'n'.
There are at least two reasons for breaking ties between events of same time stamps:
int EventRecvTimeLocalTieBrkCmp< EventTy >::compare | ( | const EventTy & | left, | |
const EventTy & | right | |||
) | const [inline] |
Compares two events 'left' and 'right' based on getRecvTime().
if recvTime is same, then we compare the sender (using id), because two events from the same sender should not be reordered. If the sender is the same then we use the id on the event to break the tie, since, sender is guaranteed to assign a unique id to events
left | ||
right |
bool EventRecvTimeLocalTieBrkCmp< EventTy >::operator() | ( | const EventTy & | left, | |
const EventTy & | right | |||
) | const [inline] |
returns true if left > right Since std::priority_queue is a max heap, we use > semantics instead of < in order to get a min heap and thus process events in increasing order of recvTime.