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

The base class from which various templated Fifo classes are derived. More...

#include <AbstractFifo.hxx>

Inheritance diagram for resip::AbstractFifo< T >:
[legend]

Public Member Functions

 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)
 
virtual void clear ()
 remove all elements in the queue (or not)
 
- 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.
 

Protected Types

typedef std::deque< T > Messages
 

Protected Member Functions

T getNext ()
 Returns the first message available.
 
bool getNext (int ms, T &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 T &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

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<typename T>
class resip::AbstractFifo< T >

The base class from which various templated Fifo classes are derived.

(aka template hoist) AbstractFifo's get operations are all threadsafe; AbstractFifo does not define any put operations (these are defined in subclasses).

Note
Users of the resip stack will not need to interact with this class directly in most cases. Look at Fifo and TimeLimitFifo instead.

Definition at line 125 of file AbstractFifo.hxx.

Member Typedef Documentation

◆ Messages

template<typename T >
typedef std::deque<T> resip::AbstractFifo< T >::Messages
protected

Definition at line 299 of file AbstractFifo.hxx.

Constructor & Destructor Documentation

◆ AbstractFifo()

template<typename T >
resip::AbstractFifo< T >::AbstractFifo ( )
inline

Constructor.

Parameters
maxSizemax number of messages to keep

Definition at line 132 of file AbstractFifo.hxx.

◆ ~AbstractFifo()

template<typename T >
virtual resip::AbstractFifo< T >::~AbstractFifo ( )
inlinevirtual

Definition at line 140 of file AbstractFifo.hxx.

Member Function Documentation

◆ add()

template<typename T >
size_t resip::AbstractFifo< T >::add ( const T &  item)
inlineprotected

Definition at line 381 of file AbstractFifo.hxx.

◆ addMultiple()

template<typename T >
size_t resip::AbstractFifo< T >::addMultiple ( Messages &  items)
inlineprotected

Definition at line 390 of file AbstractFifo.hxx.

◆ averageServiceTimeMicroSec()

template<typename T >
virtual time_t resip::AbstractFifo< T >::averageServiceTimeMicroSec ( ) const
inlinevirtual

Returns the average time it takes for individual messages to be serviced (in micro-seconds)

Implements resip::FifoStatsInterface.

Definition at line 198 of file AbstractFifo.hxx.

◆ clear()

◆ empty()

template<typename T >
bool resip::AbstractFifo< T >::empty ( ) const
inline

is the queue empty?

Returns
true if the queue is empty and false otherwise

Definition at line 148 of file AbstractFifo.hxx.

◆ expectedWaitTimeMilliSec()

template<typename T >
virtual time_t resip::AbstractFifo< T >::expectedWaitTimeMilliSec ( ) const
inlinevirtual

Returns the expected time it will take to service all messages currently in the queue (in milli-seconds)

Implements resip::FifoStatsInterface.

Definition at line 193 of file AbstractFifo.hxx.

◆ getCountDepth()

◆ getMultiple() [1/2]

template<typename T >
bool resip::AbstractFifo< T >::getMultiple ( int  ms,
Messages &  other,
unsigned int  max 
)
inlineprotected

Definition at line 328 of file AbstractFifo.hxx.

◆ getMultiple() [2/2]

template<typename T >
void resip::AbstractFifo< T >::getMultiple ( Messages &  other,
unsigned int  max 
)
inlineprotected

Definition at line 301 of file AbstractFifo.hxx.

◆ getNext() [1/2]

template<typename T >
T resip::AbstractFifo< T >::getNext ( )
inlineprotected

Returns the first message available.

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.

Returns
the first message available

Definition at line 216 of file AbstractFifo.hxx.

◆ getNext() [2/2]

template<typename T >
bool resip::AbstractFifo< T >::getNext ( int  ms,
T &  toReturn 
)
inlineprotected

Returns the next message available.

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 245 of file AbstractFifo.hxx.

◆ getTimeDepth()

template<typename T >
virtual time_t resip::AbstractFifo< T >::getTimeDepth ( ) const
inlinevirtual

computes the time delta between the oldest and newest queue members

Note
defaults to zero, overridden by TimeLimitFifo<T>
Returns
the time delta between the oldest and newest queue members

Implements resip::FifoStatsInterface.

Reimplemented in resip::TimeLimitFifo< Msg >, resip::TimeLimitFifo< FifoEvent >, resip::TimeLimitFifo< proton::message >, resip::TimeLimitFifo< ReceivedData >, resip::TimeLimitFifo< resip::ApplicationMessage >, resip::TimeLimitFifo< resip::Data >, and resip::TimeLimitFifo< resip::Message >.

Definition at line 183 of file AbstractFifo.hxx.

◆ messageAvailable()

template<typename T >
bool resip::AbstractFifo< T >::messageAvailable ( ) const
inline

is a message available?

Return values
trueif a message is available and false otherwise

Definition at line 172 of file AbstractFifo.hxx.

◆ onFifoPolled()

template<typename T >
virtual void resip::AbstractFifo< T >::onFifoPolled ( )
inlineprotectedvirtual

Definition at line 428 of file AbstractFifo.hxx.

◆ onMessagePopped()

template<typename T >
virtual void resip::AbstractFifo< T >::onMessagePopped ( unsigned int  num = 1)
inlineprotectedvirtual

Called when a message (or messages) are removed from this fifo.

Used to drive service time calculations.

Definition at line 466 of file AbstractFifo.hxx.

◆ onMessagePushed()

template<typename T >
virtual void resip::AbstractFifo< T >::onMessagePushed ( int  num)
inlineprotectedvirtual

Definition at line 472 of file AbstractFifo.hxx.

◆ size()

template<typename T >
virtual unsigned int resip::AbstractFifo< T >::size ( ) const
inlinevirtual

get the current size of the fifo.

Note
Note you should not use this function to determine whether a call to getNext() will block or not. Use messageAvailable() instead.
Returns
the number of messages in the queue

Definition at line 161 of file AbstractFifo.hxx.

Member Data Documentation

◆ mAverageServiceTimeMicroSec

template<typename T >
uint32_t resip::AbstractFifo< T >::mAverageServiceTimeMicroSec
mutableprotected

Definition at line 422 of file AbstractFifo.hxx.

◆ mCondition

template<typename T >
Condition resip::AbstractFifo< T >::mCondition
protected

condition for waiting on new queue items

Definition at line 418 of file AbstractFifo.hxx.

◆ mCounter

template<typename T >
uint32_t resip::AbstractFifo< T >::mCounter
mutableprotected

Definition at line 421 of file AbstractFifo.hxx.

◆ mFifo

template<typename T >
Messages resip::AbstractFifo< T >::mFifo
protected

container for FIFO items

Definition at line 414 of file AbstractFifo.hxx.

◆ mLastSampleTakenMicroSec

template<typename T >
uint64_t resip::AbstractFifo< T >::mLastSampleTakenMicroSec
mutableprotected

Definition at line 420 of file AbstractFifo.hxx.

◆ mMutex

template<typename T >
Mutex resip::AbstractFifo< T >::mMutex
mutableprotected

access serialization lock

Definition at line 416 of file AbstractFifo.hxx.

◆ mSize

template<typename T >
uint32_t resip::AbstractFifo< T >::mSize
protected

Definition at line 426 of file AbstractFifo.hxx.


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