#include <messenger.h>

Public Member Functions | |
| Messenger (const char *name, void(*func)(T &data)=NULL) throw (Exception) | |
| bool | getMessage (nodeId id, string &message, bool block=false) |
| bool | setMessageHandler (void(*func)(string &message)) |
| bool | setHandler (void(*func)(SerializableObject *o)) |
Protected Member Functions | |
| bool | pushMessage (chain &c) |
Protected Attributes | |
| std::queue< string > | q |
| void(* | handler )(T &) |
Definition at line 133 of file messenger.h.
| libglass::Messenger< T, T, T >::Messenger | ( | const char * | name, | |
| void(*)(T &data) | func = NULL | |||
| ) | throw (Exception) [inline] |
Definition at line 143 of file messenger.h.
| bool libglass::Messenger< T, T, T >::getMessage | ( | nodeId | id, | |
| string & | message, | |||
| bool | block = false | |||
| ) |
Gets a message from a given node.
| id | The id of the node that you want to get a message from. | |
| message | A string where the message will be stored. | |
| block | If true, the call will block until a message arrives. |
| true | if a package was available and successfully stored in message. | |
| false | otherwise. |
| bool libglass::Messenger< T, T, T >::pushMessage | ( | chain & | ) | [inline, protected, virtual] |
Enqueues locally a messaged received by the network.
| s | The packed message. |
| True | if successfully queued. | |
| False | if an error occurred. |
Implements libglass::_Messenger.
Definition at line 138 of file messenger.h.
| bool libglass::Messenger< T, T, T >::setHandler | ( | void(*)(SerializableObject *o) | func | ) |
Sets a handler.
If the queue is not empty, the handler is called for every event in queue.
The handler is responsible for freeing the object.
| True | if successfull. | |
| False | otherwise. |
| bool libglass::Messenger< T, T, T >::setMessageHandler | ( | void(*)(string &message) | func | ) |
void(* libglass::Messenger< T, T, T >::handler)(T &) [protected] |
std::queue<string> libglass::Messenger< T, T, T >::q [protected] |
Definition at line 135 of file messenger.h.
1.5.8