reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::Fifo< Msg > Class Template Reference

A templated, threadsafe message-queue class. More...

#include <Fifo.hxx>

Inheritance diagram for resip::Fifo< Msg >:
[legend]

Public Types

typedef AbstractFifo< Msg * >::Messages Messages
 

Public Member Functions

 Fifo (AsyncProcessHandler *interruptor=0)
 
virtual ~Fifo ()
 
size_t add (Msg *msg)
 Add a message to the fifo.
 
size_t addMultiple (Messages &msgs)
 
Msg * getNext ()
 Returns the first message available.
 
Msg * getNext (int ms)
 Returns the next message available.
 
void getMultiple (Messages &other, unsigned int max)
 
bool getMultiple (int ms, Messages &other, unsigned int max)
 
virtual void clear ()
 delete all elements in the queue
 
void setInterruptor (AsyncProcessHandler *interruptor)
 
- Public Member Functions inherited from resip::AbstractFifo< Msg * >
 AbstractFifo ()
 Constructor.
 
virtual ~AbstractFifo ()
 
bool empty () const
 is the queue empty?
 
virtual unsigned int size () const
 get the current size of the fifo.
 
bool messageAvailable () const
 is a message available?
 
virtual time_t getTimeDepth () const
 computes the time delta between the oldest and newest queue members
 
virtual size_t getCountDepth () const
 Returns the number of elements in the FIFO.
 
virtual time_t expectedWaitTimeMilliSec () const
 Returns the expected time it will take to service all messages currently in the queue (in milli-seconds)
 
virtual time_t averageServiceTimeMicroSec () const
 Returns the average time it takes for individual messages to be serviced (in micro-seconds)
 
- Public Member Functions inherited from resip::FifoStatsInterface
 FifoStatsInterface ()
 
virtual ~FifoStatsInterface ()
 
uint8_t getRole () const
 
void setRole (uint8_t role)
 
void setDescription (const resip::Data &description)
 Sets the description for this fifo.
 
virtual const resip::Data & getDescription () const
 Gets the description for this fifo.
 

Additional Inherited Members

- Protected Types inherited from resip::AbstractFifo< Msg * >
typedef std::deque< Msg * > Messages
 
- Protected Member Functions inherited from resip::AbstractFifo< Msg * >
Msg * getNext ()
 Returns the first message available.
 
bool getNext (int ms, Msg * &toReturn)
 Returns the next message available.
 
void getMultiple (Messages &other, unsigned int max)
 
bool getMultiple (int ms, Messages &other, unsigned int max)
 
size_t add (const Msg * &item)
 
size_t addMultiple (Messages &items)
 
virtual void onFifoPolled ()
 
virtual void onMessagePopped (unsigned int num=1)
 Called when a message (or messages) are removed from this fifo.
 
virtual void onMessagePushed (int num)
 
- Protected Attributes inherited from resip::AbstractFifo< Msg * >
Messages mFifo
 container for FIFO items
 
Mutex mMutex
 access serialization lock
 
Condition mCondition
 condition for waiting on new queue items
 
uint64_t mLastSampleTakenMicroSec
 
uint32_t mCounter
 
uint32_t mAverageServiceTimeMicroSec
 
uint32_t mSize
 
- Protected Attributes inherited from resip::FifoStatsInterface
Data mDescription
 
uint8_t mRole
 

Detailed Description

template<class Msg>
class resip::Fifo< Msg >

A templated, threadsafe message-queue class.

Definition at line 15 of file Fifo.hxx.

Member Typedef Documentation

◆ Messages

template<class Msg >
typedef AbstractFifo<Msg*>::Messages resip::Fifo< Msg >::Messages

Definition at line 30 of file Fifo.hxx.

Constructor & Destructor Documentation

◆ Fifo()

template<class Msg >
resip::Fifo< Msg >::Fifo ( AsyncProcessHandler *  interruptor = 0)

Definition at line 66 of file Fifo.hxx.

◆ ~Fifo()

template<class Msg >
resip::Fifo< Msg >::~Fifo ( )
virtual

Definition at line 73 of file Fifo.hxx.

Member Function Documentation

◆ add()

template<class Msg >
size_t resip::Fifo< Msg >::add ( Msg *  msg)

Add a message to the fifo.

Definition at line 102 of file Fifo.hxx.

◆ addMultiple()

template<class Msg >
size_t resip::Fifo< Msg >::addMultiple ( Messages &  msgs)

Definition at line 115 of file Fifo.hxx.

◆ clear()

template<class Msg >
void resip::Fifo< Msg >::clear ( )
virtual

delete all elements in the queue

Reimplemented from resip::AbstractFifo< Msg * >.

Definition at line 89 of file Fifo.hxx.

◆ getMultiple() [1/2]

template<class Msg >
bool resip::Fifo< Msg >::getMultiple ( int  ms,
Messages &  other,
unsigned int  max 
)

Definition at line 152 of file Fifo.hxx.

◆ getMultiple() [2/2]

template<class Msg >
void resip::Fifo< Msg >::getMultiple ( Messages &  other,
unsigned int  max 
)

Definition at line 145 of file Fifo.hxx.

◆ getNext() [1/2]

template<class Msg >
Msg * resip::Fifo< 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.

Definition at line 129 of file Fifo.hxx.

◆ getNext() [2/2]

template<class Msg >
Msg * resip::Fifo< 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 136 of file Fifo.hxx.

◆ setInterruptor()

template<class Msg >
void resip::Fifo< Msg >::setInterruptor ( AsyncProcessHandler *  interruptor)

Definition at line 80 of file Fifo.hxx.


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