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

#include <TimeLimitFifo.hxx>

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

Public Types

enum  DepthUsage { EnforceTimeDepth , IgnoreTimeDepth , InternalElement }
 

Public Member Functions

 TimeLimitFifo (unsigned int maxDurationSecs, unsigned int maxSize)
 After it runs out of the lesser of these limits it will start to refuse messages.
 
virtual ~TimeLimitFifo ()
 
bool add (Msg *msg, DepthUsage usage)
 Add a message to the fifo.
 
Msg * getNext ()
 Returns the first message available.
 
Msg * getNext (int ms)
 Returns the first message available within a time limit.
 
virtual time_t timeDepth () const
 Return the time depth of the queue.
 
bool wouldAccept (DepthUsage usage) const
 would an add called now work?
 
void clear ()
 removes all items from the FIFO
 
virtual size_t getCountDepth () const
 gets the depth of the FIFO
 
virtual time_t getTimeDepth () const
 Return the time depth of the queue.
 
virtual size_t getCountDepthTolerance () const
 returns the FIFO count depth tolerance
 
virtual time_t getTimeDepthTolerance () const
 returns the FIFO time depth tolerance
 
virtual void setCountDepthTolerance (unsigned int max)
 set the count depth tolerance of the FIFO
 
virtual void setTimeDepthTolerance (unsigned int maxSecs)
 set the time depth tolerance of the FIFO
 
- Public Member Functions inherited from resip::AbstractFifo< Timestamped< 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 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< Timestamped< Msg * > >
typedef std::deque< Timestamped< Msg * > > Messages
 
- Protected Member Functions inherited from resip::AbstractFifo< Timestamped< Msg * > >
Timestamped< Msg * > getNext ()
 Returns the first message available.
 
bool getNext (int ms, Timestamped< 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 Timestamped< 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< Timestamped< 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::TimeLimitFifo< Msg >

Definition at line 91 of file TimeLimitFifo.hxx.

Member Enumeration Documentation

◆ DepthUsage

template<class Msg >
enum resip::TimeLimitFifo::DepthUsage
Enumerator
EnforceTimeDepth 
IgnoreTimeDepth 
InternalElement 
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 94 of file TimeLimitFifo.hxx.

Constructor & Destructor Documentation

◆ TimeLimitFifo()

template<class Msg >
resip::TimeLimitFifo< Msg >::TimeLimitFifo ( unsigned int  maxDurationSecs,
unsigned int  maxSize 
)

After it runs out of the lesser of these limits it will start to refuse messages.

Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 221 of file TimeLimitFifo.hxx.

◆ ~TimeLimitFifo()

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

Member Function Documentation

◆ add()

template<class Msg >
bool resip::TimeLimitFifo< Msg >::add ( Msg *  msg,
DepthUsage  usage 
)

Add a message to the fifo.

return true iff succeeds

Parameters
Msg*'Message pointer'
DepthUsage: (Needs work...) EnforceTimeDepth – external (non ACK) requests IgnoreTimeDepth – external reponse and ACK InternalElement – internal messages (timers, application postbacks..); use reserved queue space

+---------------------------------------------------—+ | | | | +---------------------------------------------------—+ <--—enforce----------------—> <------------—ignoreTimeDepth---------—> <------------------— internalElement-------------—>

enforce will drop things that exceed the queue ignore will go past that limit to the extent of the queue (eg. internal will basically not drop anything

Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 238 of file TimeLimitFifo.hxx.

◆ clear()

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

removes all items from the FIFO

Reimplemented from resip::AbstractFifo< Timestamped< Msg * > >.

Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 346 of file TimeLimitFifo.hxx.

◆ getCountDepth()

template<class Msg >
size_t resip::TimeLimitFifo< Msg >::getCountDepth ( ) const
virtual

gets the depth of the FIFO

Returns
the depth of the FIFO

Reimplemented from resip::AbstractFifo< Timestamped< Msg * > >.

Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 359 of file TimeLimitFifo.hxx.

◆ getCountDepthTolerance()

template<class Msg >
size_t resip::TimeLimitFifo< Msg >::getCountDepthTolerance ( ) const
virtual

returns the FIFO count depth tolerance

Returns
the FIFO count depth tolerance
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 366 of file TimeLimitFifo.hxx.

◆ getNext() [1/2]

template<class Msg >
Msg * resip::TimeLimitFifo< Msg >::getNext ( )

Returns the first message available.

Note
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 next message in the queue
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 268 of file TimeLimitFifo.hxx.

◆ getNext() [2/2]

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

Returns the first message available within a time limit.

Parameters
msthe maximum amount of time to wait in milliseconds for a message
Note
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 next message in the queue, or NULL if the time limit elapses

Definition at line 276 of file TimeLimitFifo.hxx.

◆ getTimeDepth()

template<class Msg >
time_t resip::TimeLimitFifo< Msg >::getTimeDepth ( ) const
virtual

Return the time depth of the queue.

Returns
the time delta between the youngest and oldest queue members
Note
equivalent to timeDepth()

Reimplemented from resip::AbstractFifo< Timestamped< Msg * > >.

Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 373 of file TimeLimitFifo.hxx.

◆ getTimeDepthTolerance()

template<class Msg >
time_t resip::TimeLimitFifo< Msg >::getTimeDepthTolerance ( ) const
virtual

returns the FIFO time depth tolerance

Returns
the FIFO time depth tolerance
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 380 of file TimeLimitFifo.hxx.

◆ setCountDepthTolerance()

template<class Msg >
void resip::TimeLimitFifo< Msg >::setCountDepthTolerance ( unsigned int  max)
virtual

set the count depth tolerance of the FIFO

Todo:
getCountDepthTolerance returns a size_t and this takes an unsigned int, f.setCountDepthTolerance(f.getCountDepthTolerance()) will fail to compile on many systems [!]
Parameters
maxthe new count depth tolerance of the FIFO
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 387 of file TimeLimitFifo.hxx.

◆ setTimeDepthTolerance()

template<class Msg >
void resip::TimeLimitFifo< Msg >::setTimeDepthTolerance ( unsigned int  maxSecs)
virtual

set the time depth tolerance of the FIFO

Parameters
maxSecthe maximum time depth tolerance
Todo:
examine parallelism in units [!]
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 395 of file TimeLimitFifo.hxx.

◆ timeDepth()

template<class Msg >
time_t resip::TimeLimitFifo< Msg >::timeDepth ( ) const
virtual

Return the time depth of the queue.

Returns
the time delta between the youngest and oldest queue members
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 338 of file TimeLimitFifo.hxx.

◆ wouldAccept()

template<class Msg >
bool resip::TimeLimitFifo< Msg >::wouldAccept ( DepthUsage  usage) const

would an add called now work?

Parameters
usagewhat depth policy should be used to determine if the call would work
Returns
true if an add called now would work
See also
DepthUsage
Examples
/home/runner/work/resiprocate/resiprocate/rutil/TimeLimitFifo.hxx.

Definition at line 259 of file TimeLimitFifo.hxx.


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