reSIProcate/stack  9359
Public Member Functions | Protected Attributes | Friends
resip::BaseTimerQueue Class Reference

This class takes a fifo as a place to where you can write your stuff. More...

#include <TimerQueue.hxx>

Inheritance diagram for resip::BaseTimerQueue:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~BaseTimerQueue ()=0
 deletes the message associated with the timer as well.
virtual void process ()=0
 gets the set of timers that have fired and inserts TimerMsg into the state machine fifo and application messages into the TU fifo
int size () const
bool empty () const
unsigned int msTillNextTimer ()
 Give me the time before the next timer will fire in milliseconds.

Protected Attributes

std::multiset< TimermTimers

Friends

EncodeStreamoperator<< (EncodeStream &, const BaseTimerQueue &)
std::ostream & operator<< (std::ostream &strm, const BaseTimerQueue &)

Detailed Description

This class takes a fifo as a place to where you can write your stuff.

In the main loop when using this you need to call process() on this. During Transaction processing, TimerMessages and SIP messages get generated.dcm! - refactor, templatize

Definition at line 31 of file TimerQueue.hxx.


Constructor & Destructor Documentation

BaseTimerQueue::~BaseTimerQueue ( ) [pure virtual]

deletes the message associated with the timer as well.

Definition at line 36 of file TimerQueue.cxx.

References mTimers.

{
   //xkd-2004-11-4
   // delete the message associated with the timer
   for (std::multiset<Timer>::iterator i = mTimers.begin(); i !=  mTimers.end(); ++i)
   {
      if (i->getMessage())
      {
         delete i->getMessage();
      }
   }
}

Member Function Documentation

bool BaseTimerQueue::empty ( ) const

Definition at line 116 of file TimerQueue.cxx.

References mTimers.

{
   return mTimers.empty();
}
unsigned int BaseTimerQueue::msTillNextTimer ( )

Give me the time before the next timer will fire in milliseconds.

Return values:
milliseconds(time until the next timer will fire)
0(implies that timers occur in the past)
INT_MAX(implies that there are no timers)

Definition at line 50 of file TimerQueue.cxx.

References resip::Timer::getTimeMs(), and mTimers.

Referenced by resip::TransactionController::getTimeTillNextProcessMS(), resip::SipStack::getTimeTillNextProcessMS(), and main().

{
   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;
   }
}

Here is the call graph for this function:

virtual void resip::BaseTimerQueue::process ( ) [pure virtual]

gets the set of timers that have fired and inserts TimerMsg into the state machine fifo and application messages into the TU fifo

Implemented in resip::TimerQueue, and resip::BaseTimeLimitTimerQueue.

int BaseTimerQueue::size ( ) const

Definition at line 110 of file TimerQueue.cxx.

References mTimers.

Referenced by resip::SipStack::dump(), and resip::TransactionController::getTimerQueueSize().

{
   return (int)mTimers.size();
}

Friends And Related Function Documentation

EncodeStream& operator<< ( EncodeStream ,
const BaseTimerQueue  
) [friend]
std::ostream& operator<< ( std::ostream &  strm,
const BaseTimerQueue  
) [friend]

Member Data Documentation

std::multiset<Timer> resip::BaseTimerQueue::mTimers [protected]

The documentation for this class was generated from the following files: