|
reSIProcate/rutil
9694
|
#include <GenericTimerQueue.hxx>
Classes | |
| class | TimerEntry |
Public Member Functions | |
| virtual | ~GenericTimerQueue () |
| deletes the message associated with the timer as well. | |
| virtual void | process () |
| virtual void | processTimer (T *)=0 |
| void | add (T *event, unsigned long msOffset) |
| int | size () const |
| bool | empty () const |
| unsigned int | msTillNextTimer () |
Protected Attributes | |
| std::multiset< TimerEntry< T > > | mTimers |
Definition at line 12 of file GenericTimerQueue.hxx.
| virtual resip::GenericTimerQueue< T >::~GenericTimerQueue | ( | ) | [inline, virtual] |
deletes the message associated with the timer as well.
Definition at line 41 of file GenericTimerQueue.hxx.
References resip::GenericTimerQueue< T >::mTimers.
| void resip::GenericTimerQueue< T >::add | ( | T * | event, |
| unsigned long | msOffset | ||
| ) | [inline] |
Definition at line 86 of file GenericTimerQueue.hxx.
References resip::GenericTimerQueue< T >::mTimers.
{
TimerEntry<T> t(msOffset, event);
mTimers.insert(t);
}
| bool resip::GenericTimerQueue< T >::empty | ( | ) | const [inline] |
Definition at line 97 of file GenericTimerQueue.hxx.
References resip::GenericTimerQueue< T >::mTimers.
{
return mTimers.empty();
}
| unsigned int resip::GenericTimerQueue< T >::msTillNextTimer | ( | ) | [inline] |
Definition at line 102 of file GenericTimerQueue.hxx.
References resip::Timer::getTimeMs(), and resip::GenericTimerQueue< T >::mTimers.
Referenced by resip::GenericTimerQueue< T >::process().
{
if (!mTimers.empty())
{
UInt64 next = mTimers.begin()->mWhen;
UInt64 now = Timer::getTimeMs();
if (now > next)
{
return 0;
}
else
{
UInt64 ret64 = next - now;
if ( ret64 > UInt64(INT_MAX) )
{
return INT_MAX;
}
else
{
int ret = int(ret64);
return ret;
}
}
}
else
{
return INT_MAX;
}
}

| virtual void resip::GenericTimerQueue< T >::process | ( | ) | [inline, virtual] |
dcm! -- erasing the range didn't work...upper bound was prob. end()
Definition at line 49 of file GenericTimerQueue.hxx.
References resip::GenericTimerQueue< T >::msTillNextTimer(), resip::GenericTimerQueue< T >::mTimers, and resip::GenericTimerQueue< T >::processTimer().
{
if (!mTimers.empty() && msTillNextTimer() == 0)
{
TimerEntry<T> now(0, 0);
// hacky solution, needs work, insertion from processTimer
// caused bizarre infinite loop issues in previous revision;
// this code is in desperate need of help
typedef typename std::multiset<TimerEntry<T> > TimerSet;
typedef std::vector<typename TimerSet::iterator> ItVector;
ItVector iterators;
typename TimerSet::iterator end = mTimers.upper_bound(now);
typename TimerSet::iterator begin = mTimers.begin();
for (typename TimerSet::iterator i = begin; i != end; ++i)
{
iterators.push_back(i);
}
for (typename ItVector::iterator i = iterators.begin(); i != iterators.end(); ++i)
{
assert((*i)->getEvent());
processTimer((*i)->getEvent());
}
for (typename ItVector::iterator i = iterators.begin(); i != iterators.end(); ++i)
{
mTimers.erase(*i);
}
}
}

| virtual void resip::GenericTimerQueue< T >::processTimer | ( | T * | ) | [pure virtual] |
Referenced by resip::GenericTimerQueue< T >::process().
| int resip::GenericTimerQueue< T >::size | ( | ) | const [inline] |
Definition at line 92 of file GenericTimerQueue.hxx.
References resip::GenericTimerQueue< T >::mTimers.
{
return mTimers.size();
}
std::multiset<TimerEntry<T> > resip::GenericTimerQueue< T >::mTimers [protected] |
Definition at line 135 of file GenericTimerQueue.hxx.
Referenced by resip::GenericTimerQueue< T >::add(), resip::GenericTimerQueue< T >::empty(), resip::GenericTimerQueue< T >::msTillNextTimer(), resip::GenericTimerQueue< T >::process(), resip::GenericTimerQueue< T >::size(), and resip::GenericTimerQueue< T >::~GenericTimerQueue().
1.7.5.1