template < class Msg > class FifoBase

First in first out list interface, with the added functionality of being able to handle timed entries

Inheritance:


Public Fields

typedef Vocal::TimeAndDate::TimerEntryId EventId
Id for delayed events

Public Methods

void add(const Msg &)
Add a message to the fifo
EventId addDelayMs( const Msg &, const milliseconds_t relativeTimeout)
If the relative timeout (in milliseconds) is greater than 0, the message will be added to the fifo after the number of milliseconds have passed
int block(milliseconds_t relativeTimeout = -1) throw( VException )
Blocks until a message is available, or the specified timeout has expired
void cancel(EventId)
Cancel a delayed event
Msg getNext() throw( VException )
Returns the first message available
bool messageAvailable()
Returns true if a message is available
bool operator!=(const FifoBase &)
Relational operators
bool operator< (const FifoBase &)
Relational operators
bool operator<=(const FifoBase &)
Relational operators
bool operator==(const FifoBase &)
Relational operators
bool operator> (const FifoBase &)
Relational operators
bool operator>=(const FifoBase &)
Relational operators
void shutdown()
Indicate that the poll no longer accepts messages
unsigned int size()
Get the current size of the FIFO Note that the current size INCLUDES all of the pending events, even those which have not yet activated so you should NOT use this function to determine whether a call to getNext will block or not
virtual ~FifoBase()
Delete the fifo

Protected Methods

FifoBase()
Create an empty fifo
virtual bool messageAvailableNoLock()
Returns true if a message is available
virtual int wait(milliseconds_t relativeTimeout) throw( VException )
Blocks the thread, for the given time, waiting for a message
virtual void wakeup() throw( VException )
Wake's up the blocked thread

Private Methods

FifoBase(const FifoBase &)
Copying suppressed
FifoBase& operator=(const FifoBase &)
Copying suppressed

Documentation

First in first out list interface, with the added functionality of being able to handle timed entries
typedef Vocal::TimeAndDate::TimerEntryId EventId
Id for delayed events. Needed to cancel an event.

FifoBase()
Create an empty fifo

virtual ~FifoBase()
Delete the fifo

void add(const Msg &)
Add a message to the fifo

EventId addDelayMs( const Msg &, const milliseconds_t relativeTimeout)
If the relative timeout (in milliseconds) is greater than 0, the message will be added to the fifo after the number of milliseconds have passed. The returned value is an opaque id that can be used to cancel the event before the timer expires. If the time is specified as 0, this defaults the to the regular add(), returning an id of 0.

void cancel(EventId)
Cancel a delayed event

int block(milliseconds_t relativeTimeout = -1) throw( VException )
Blocks until a message is available, or the specified timeout has expired. If the return code is 0, then the fifo was interrupted via a signal or the timeout expired without a message being added to the queue. Using block is the only way to guarantee detection of a signal has been thrown.

Msg getNext() throw( VException )
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.

unsigned int size()
Get the current size of the FIFO Note that the current size INCLUDES all of the pending events, even those which have not yet activated so you should NOT use this function to determine whether a call to getNext will block or not. Use messageAvailable() instead.

bool messageAvailable()
Returns true if a message is available

void shutdown()
Indicate that the poll no longer accepts messages

bool operator==(const FifoBase &)
Relational operators. Useful if this is ever in a container.

bool operator!=(const FifoBase &)
Relational operators. Useful if this is ever in a container.

bool operator< (const FifoBase &)
Relational operators. Useful if this is ever in a container.

bool operator<=(const FifoBase &)
Relational operators. Useful if this is ever in a container.

bool operator> (const FifoBase &)
Relational operators. Useful if this is ever in a container.

bool operator>=(const FifoBase &)
Relational operators. Useful if this is ever in a container.

virtual bool messageAvailableNoLock()
Returns true if a message is available. The default implementation looks at the size of the fifo. Derived classes may also observe other resources as well. Note that the mutex should not be locked by this routine, since it would cause a deadlock.

virtual void wakeup() throw( VException )
Wake's up the blocked thread. Note that the mutex is locked upon entry. It is the responsibility of the user to unlock the mutex if necessary, making sure to relock it before exit.

virtual int wait(milliseconds_t relativeTimeout) throw( VException )
Blocks the thread, for the given time, waiting for a message. Note that the mutex is locked upon entry. It is the responsibility of the user to unlock the mutex if necessary, making sure to relock it before exit. The return code is positive for to indicate activity, i.e. messages added to the queue. For a signal or a timeout, 0 should be returned.

FifoBase(const FifoBase &)
Copying suppressed

FifoBase& operator=(const FifoBase &)
Copying suppressed


Direct child classes:
Fifo

alphabetic index hierarchy of classes


generated by doc++