Yate
|
A message queue. More...
#include <yatengine.h>
Public Member Functions | |
MessageQueue (const char *hookName, int numWorkers=0) | |
~MessageQueue () | |
virtual bool | enqueue (Message *msg) |
bool | dequeue () |
void | addFilter (const char *name, const char *value) |
void | removeFilter (const String &name) |
virtual void | clear () |
void | removeThread (Thread *thread) |
unsigned int | count () const |
const NamedList & | getFilters () const |
virtual bool | matchesFilter (const Message &msg) |
Public Member Functions inherited from RefObject | |
RefObject () | |
virtual | ~RefObject () |
virtual void * | getObject (const String &name) const |
virtual bool | alive () const |
bool | ref () |
bool | deref () |
int | refcount () const |
virtual void | destruct () |
Public Member Functions inherited from GenObject | |
GenObject () | |
virtual | ~GenObject () |
virtual const String & | toString () const |
NamedCounter * | getObjCounter () const |
NamedCounter * | setObjCounter (NamedCounter *counter) |
Public Member Functions inherited from Mutex | |
Mutex (bool recursive=false, const char *name=0) | |
Mutex (const Mutex &original) | |
~Mutex () | |
Mutex & | operator= (const Mutex &original) |
virtual bool | lock (long maxwait=-1) |
virtual bool | unlock () |
virtual bool | locked () const |
const char * | owner () const |
bool | recursive () const |
Public Member Functions inherited from Lockable | |
virtual | ~Lockable () |
virtual bool | check (long maxwait=-1) |
virtual bool | unlockAll () |
Protected Member Functions | |
virtual void | received (Message &msg) |
Protected Member Functions inherited from RefObject | |
virtual void | zeroRefs () |
bool | resurrect () |
virtual void | destroyed () |
Friends | |
class | Engine |
Additional Inherited Members | |
Static Public Member Functions inherited from RefObject | |
static bool | alive (const RefObject *obj) |
static bool | efficientIncDec () |
Static Public Member Functions inherited from GenObject | |
static void * | getObject (const String &name, const GenObject *obj) |
static bool | getObjCounting () |
static void | setObjCounting (bool enable) |
static NamedCounter * | getObjCounter (const String &name, bool create=true) |
static ObjList & | getObjCounters () |
Static Public Member Functions inherited from Mutex | |
static int | count () |
static int | locks () |
static bool | efficientTimedLock () |
Static Public Member Functions inherited from Lockable | |
static void | wait (unsigned long maxwait) |
static unsigned long | wait () |
static void | startUsingNow () |
static void | enableSafety (bool safe=true) |
static bool | safety () |
A message queue.
MessageQueue class allows to create a private queue for a message who matches the specified filters.
MessageQueue | ( | const char * | hookName, |
int | numWorkers = 0 |
||
) |
Creates a new message queue.
hookName | Name of the message served by this queue |
numWorkers | The number of workers who serve this queue |
~MessageQueue | ( | ) |
Destroys the message queue
void addFilter | ( | const char * | name, |
const char * | value | ||
) |
Add a new filter to this queue
name | The filter name |
value | The filter value |
|
virtual |
Clear private data
Implements MessageHook.
|
inline |
Helper method to obtain the number of unprocessed messages in the queue
bool dequeue | ( | ) |
Process a message from the waiting queue
|
virtual |
Append a message in the queue
msg | The message to enqueue, will be destroyed after the processing is done |
Implements MessageHook.
|
inline |
Obtain the filter list for this queue
|
virtual |
Check if the given message can be inserted in this queue
msg | The message to check |
Implements MessageHook.
|
protectedvirtual |
Callback method for message processing Default calls Engine::dispatch
msg | The message to process |
void removeFilter | ( | const String & | name | ) |
Remove a filter form this queue
name | The filter name |
void removeThread | ( | Thread * | thread | ) |
Remove a thread from workers list
thread | The thread to remove |