The Messenger class is the host of all inboxes for all threads.
More...
#include <Messenger.h>
|
| Messenger () |
|
void | addInbox (const char *name, unsigned int id) |
| Creates a new inbox with the given name for the current thread. More...
|
|
unsigned int | getMessagesCount (const char *name) |
| Retrieves the current number of messages in the inbox with the given name. More...
|
|
void | sendMessage (const char *message, unsigned int messageId, void *data, const char *dest, const char *from) |
| Sends a message to a thread. More...
|
|
Message | getNextMessage (const char *threadName) |
| Returns the next message in the message queue. More...
|
|
Message | getNextMessage (const char *threadName, const char *sender) |
| Returns the next message from the given sender in the message queue. More...
|
|
The Messenger class is the host of all inboxes for all threads.
You can create a new inbox for your thread and request messages from it. This class also handles sending messages to other threads as well.
Neo::Messenger::Messenger |
( |
| ) |
|
|
inline |
void Neo::Messenger::addInbox |
( |
const char * |
name, |
|
|
unsigned int |
id |
|
) |
| |
Creates a new inbox with the given name for the current thread.
- Parameters
-
name | The thread name. |
id | The thread ID. |
static Messenger* Neo::Messenger::getInstance |
( |
| ) |
|
|
inlinestatic |
unsigned int Neo::Messenger::getMessagesCount |
( |
const char * |
name | ) |
|
Retrieves the current number of messages in the inbox with the given name.
- Parameters
-
- Returns
- The count of unhandled messages.
Message Neo::Messenger::getNextMessage |
( |
const char * |
threadName | ) |
|
Returns the next message in the message queue.
- Parameters
-
threadName | The thread name to retrieve the message for. |
- Returns
- The next message.
Message Neo::Messenger::getNextMessage |
( |
const char * |
threadName, |
|
|
const char * |
sender |
|
) |
| |
Returns the next message from the given sender in the message queue.
- Parameters
-
threadName | The thread name to retrieve the message for. |
sender | The sender to retrieve the message from. |
- Returns
- The next message.
void Neo::Messenger::sendMessage |
( |
const char * |
message, |
|
|
unsigned int |
messageId, |
|
|
void * |
data, |
|
|
const char * |
dest, |
|
|
const char * |
from |
|
) |
| |
Sends a message to a thread.
Adds the new message to the inbox of the receiving thread.
- Parameters
-
message | A string containing the message. |
messageId | The messageId (can be used to send simple signals) |
data | A pointer to some sort of data. |
dest | The name of the receiver. |
from | The ID of the sender. |
The documentation for this class was generated from the following file: