reSIProcate/rutil  9694
Public Member Functions | Private Attributes
resip::FiniteFifo< Msg > Class Template Reference

A templated, threadsafe message-queue class with a fixed size. More...

#include <FiniteFifo.hxx>

Inheritance diagram for resip::FiniteFifo< Msg >:
Inheritance graph
[legend]
Collaboration diagram for resip::FiniteFifo< Msg >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FiniteFifo (unsigned int maxSize)
virtual ~FiniteFifo ()
bool add (Msg *msg)
Msg * getNext ()
 Returns the first message available.
Msg * getNext (int ms)
 Returns the next message available.

Private Attributes

unsigned int mMaxSize

Detailed Description

template<class Msg>
class resip::FiniteFifo< Msg >

A templated, threadsafe message-queue class with a fixed size.

Deprecated:
Todo:
remove class

Definition at line 20 of file FiniteFifo.hxx.


Constructor & Destructor Documentation

template<class Msg >
resip::FiniteFifo< Msg >::FiniteFifo ( unsigned int  maxSize)

Definition at line 57 of file FiniteFifo.hxx.

   : AbstractFifo<Msg*>(),
   mMaxSize(maxSize)
{
}
template<class Msg >
resip::FiniteFifo< Msg >::~FiniteFifo ( ) [virtual]

Definition at line 64 of file FiniteFifo.hxx.

{
   Lock lock(mMutex); (void)lock;
   while ( ! mFifo.empty() )
   {
      delete mFifo.front();
      mFifo.pop_front();
   }
}

Member Function Documentation

template<class Msg >
bool resip::FiniteFifo< Msg >::add ( Msg *  msg)

Definition at line 76 of file FiniteFifo.hxx.

{
   Lock lock(mMutex); (void)lock;
   if (mFifo.size() >= mMaxSize)
   {
      return false;
   }
   else
   {
      mFifo.push_back(msg);
      mCondition.signal();
      return true;
   }
}
template<class Msg >
Msg * resip::FiniteFifo< Msg >::getNext ( )

Returns the first message available.

It will wait if no messages are available. If a signal interrupts the wait, it will retry the wait. Signals can therefore not be caught via getNext. If you need to detect a signal, use block prior to calling getNext.

Reimplemented from resip::AbstractFifo< Msg * >.

Definition at line 93 of file FiniteFifo.hxx.

References resip::AbstractFifo< T >::getNext().

Here is the call graph for this function:

template<class Msg >
Msg * resip::FiniteFifo< Msg >::getNext ( int  ms)

Returns the next message available.

Will wait up to ms milliseconds if no information is available. If the specified time passes or a signal interrupts the wait, this method returns 0. This interface provides no mechanism to distinguish between timeout and interrupt.

Definition at line 100 of file FiniteFifo.hxx.

References resip::AbstractFifo< T >::getNext().

{
   Msg* result(0);
   AbstractFifo<Msg*>::getNext(ms, result);
   return result;
}

Here is the call graph for this function:


Member Data Documentation

template<class Msg>
unsigned int resip::FiniteFifo< Msg >::mMaxSize [private]

Definition at line 53 of file FiniteFifo.hxx.


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