#include <MessageController.h>
Collaboration diagram for MessageController:
Public Member Functions | |
MessageController (Dispatcher *dp) | |
~MessageController () | |
double | getVisualisationTime () |
bool | processMessageFromComm (shared_ptr< vector< shared_ptr< string > > > messagebody) |
bool | sendMessageToComm (shared_ptr< vector< shared_ptr< string > > > messagebody) |
bool | communicationMode (int cMode, string filename) |
bool | communicationMode (int cMode, string thisname, string thatname) |
bool | setTimeFlow (double ntimeflowfactor) |
double | getTimeFlow () |
Private Attributes | |
Comm * | comm |
Dispatcher * | disp |
int | cmode |
shared_ptr< list< shared_ptr< vector< shared_ptr< string > > > > > | msgqueue |
pthread_mutex_t | mutex |
pthread_cond_t | cond |
double | currenttime |
double | timeflowfactor |
pthread_t | msgcontrollerthread |
bool | msgcontrollerthread_run |
Friends | |
void * | msgcontrollerThread (void *args) |
MessageController has a timestamp-ordered queue which contain the messages received from Traplas. It also controls the flow of time in the visualisation. The MessageController has a thread which sends the message from its queue to StateControl when the timestamp of the message indicates so.
Definition at line 49 of file MessageController.h.
|
Constructor.
Definition at line 138 of file MessageController.cpp. References comm, cond, currenttime, disp, msgcontrollerThread, msgcontrollerthread, msgcontrollerthread_run, msgqueue, mutex, and timeflowfactor. |
|
Definition at line 153 of file MessageController.cpp. References comm, msgcontrollerthread, and msgcontrollerthread_run. |
|
Method used by the Dispatcher to create a subclass of Comm, in this case a DbusConnection.
Definition at line 242 of file MessageController.cpp. |
|
Method used by the Dispatcher to create a subclass of Comm, in this case a filereader.
Definition at line 234 of file MessageController.cpp. Referenced by Dispatcher::communicationMode(). |
|
Definition at line 114 of file MessageController.h. References timeflowfactor. Referenced by Dispatcher::getTimeFlow(). |
|
Definition at line 77 of file MessageController.h. References currenttime. Referenced by Dispatcher::getTime(). |
|
This method is invoked by the communication-class (FileReader or DbusConnection) and puts the message in the queue at the correct place (ordered by timestamp).
Definition at line 162 of file MessageController.cpp. References cond, INITIAL_TIMESCALE, msgqueue, mutex, and timeflowfactor. Referenced by readFile(), and send(). |
|
This method is invoked by the Dispatcher to send messages to Traplas. It adds a timestamp to the message and calls sendmessage in the communication-class.
Definition at line 213 of file MessageController.cpp. References comm, currenttime, and Comm::sendMessage(). Referenced by Dispatcher::order(), and Dispatcher::setSpdInSim(). Here is the call graph for this function: ![]() |
|
Sets the timeflowfactor in the MessageController.
Definition at line 250 of file MessageController.cpp. References timeflowfactor. Referenced by Dispatcher::setTimeFlow(). |
|
In this function is the thread which is responsible for controlling the flow of time in de visualisation. Every time it gets cpu-time from the scheduler, it increments the currenttime variable according to the elapsed time and the timeflowfactor. It then looks at the queue and sends messages which can be sent. The messages are send to the Dispatcher.
Definition at line 79 of file MessageController.cpp. Referenced by MessageController(). |
|
Definition at line 54 of file MessageController.h. Referenced by communicationMode(). |
|
Definition at line 51 of file MessageController.h. Referenced by communicationMode(), MessageController(), sendMessageToComm(), and ~MessageController(). |
|
Definition at line 58 of file MessageController.h. Referenced by MessageController(), msgcontrollerThread(), and processMessageFromComm(). |
|
Definition at line 60 of file MessageController.h. Referenced by getVisualisationTime(), MessageController(), msgcontrollerThread(), and sendMessageToComm(). |
|
Definition at line 52 of file MessageController.h. Referenced by MessageController(), and msgcontrollerThread(). |
|
Definition at line 63 of file MessageController.h. Referenced by MessageController(), and ~MessageController(). |
|
Definition at line 64 of file MessageController.h. Referenced by MessageController(), msgcontrollerThread(), and ~MessageController(). |
|
Definition at line 56 of file MessageController.h. Referenced by MessageController(), msgcontrollerThread(), and processMessageFromComm(). |
|
Definition at line 57 of file MessageController.h. Referenced by MessageController(), msgcontrollerThread(), and processMessageFromComm(). |
|
Definition at line 61 of file MessageController.h. Referenced by getTimeFlow(), MessageController(), msgcontrollerThread(), processMessageFromComm(), and setTimeFlow(). |