예제 #1
0
inline bool operator<(const TimerHeapElement& a, const TimerHeapElement& b)
{
    // The comparisons below are "backwards" because the heap puts the largest 
    // element first and we want the lowest time to be the first one in the heap.
    double aFireTime = a.timer()->m_nextFireTime;
    double bFireTime = b.timer()->m_nextFireTime;
    if (bFireTime != aFireTime)
        return bFireTime < aFireTime;
    
    // We need to look at the difference of the insertion orders instead of comparing the two 
    // outright in case of overflow. 
    unsigned difference = a.timer()->m_heapInsertionOrder - b.timer()->m_heapInsertionOrder;
    return difference < UINT_MAX / 2;
}
예제 #2
0
inline TimerHeapElement::TimerHeapElement(const TimerHeapElement& o)
    : m_index(-1), m_timer(o.timer())
{
}
예제 #3
0
파일: Timer.cpp 프로젝트: Crawping/davinci
inline bool operator<(const TimerHeapElement& a, const TimerHeapElement& b)
{
    // Note, this is "backwards" because the heap puts the largest element first
    // and we want the lowest time to be the first one in the heap.
    return b.timer()->m_nextFireTime < a.timer()->m_nextFireTime;
}