MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
|
Implements communication between threads. More...
#include <ComThread.h>
Public Member Functions | |
ComThread () | |
constructor | |
virtual | ~ComThread () |
destroyer | |
Protected Member Functions | |
int | getDir () |
Returns the communication address of the object. | |
int | getMessage (std::string &msg) |
Reads the oldest message in the queue. | |
void | sendMessage (const std::string &msg, int dir) |
Sends a message to a specific address (dir < 0 to broadcast) | |
Private Member Functions | |
virtual void | execute () |
virtual method for the thread main process. | |
virtual void | onStop () |
this virtual method will be executed when the stop method is called | |
virtual int | setup () |
this virtual method will be executed when trying to start the thead, must return 0 if ok | |
Private Attributes | |
std::list< std::string > | messageQueue |
int | mydir |
Static Private Attributes | |
static std::map< int, std::list< std::string > * > | idmap |
static ClMutex | mut |
static int | nextId = 0 |
Implements communication between threads.
Objects of classes derived from ComThread can send (to a specific address) or broadcast (to everybody) messages to other ComThread derived objects
The messages received are cummulated in a FIFO queue that can be read at any moment
Definition at line 30 of file ComThread.h.