Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

Dispatcher Class Reference

Provides the coupling between the graphical part and the communications. More...

#include <Dispatcher.h>

Collaboration diagram for Dispatcher:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Dispatcher ()
 ~Dispatcher ()
bool proccessMessageFromMC (shared_ptr< vector< shared_ptr< string > > > msg)
bool dispatchMessage ()
bool setSpdInSim (int id, double speed, double ts, double te)
bool order (int Ris, int Rid, double ts, double tf)
bool communicationMode (int cMode, string filename)
bool communicationMode (int cMode, string thisName, string thatName)
bool setTimeFlow (double flowFactor)
double getTime ()
double getTimeFlow ()

Private Member Functions

bool drvparse (shared_ptr< vector< shared_ptr< string > > >)
bool loadparse (shared_ptr< vector< shared_ptr< string > > >)
bool unloadparse (shared_ptr< vector< shared_ptr< string > > >)
bool setspdparse (shared_ptr< vector< shared_ptr< string > > >)
bool locationparse (shared_ptr< vector< shared_ptr< string > > >)
bool trnewparse (shared_ptr< vector< shared_ptr< string > > >)
bool trdelparse (shared_ptr< vector< shared_ptr< string > > >)
bool newcargparse (shared_ptr< vector< shared_ptr< string > > >)
bool rmcargparse (shared_ptr< vector< shared_ptr< string > > >)
bool arcparse (shared_ptr< vector< shared_ptr< string > > >)

Private Attributes

StateControlworld
MessageControllermc
shared_ptr< queue< shared_ptr<
vector< shared_ptr< string > > > > > 
parseQ
pthread_mutex_t * mutex_ptr
pthread_cond_t * cond_ptr

Detailed Description

Provides the coupling between the graphical part and the communications.

Parses messages coming from MesssageController and calls the relevant functions in StateControl. Also constructs messages for transmision back to Traplas.

Definition at line 42 of file Dispatcher.h.


Constructor & Destructor Documentation

Dispatcher::Dispatcher  ) 
 

Definition at line 49 of file Dispatcher.cpp.

References cond_ptr, mc, mutex_ptr, parseQ, and world.

Dispatcher::~Dispatcher  ) 
 

Definition at line 60 of file Dispatcher.cpp.

References mc, and world.


Member Function Documentation

bool Dispatcher::arcparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 456 of file Dispatcher.cpp.

References StateControl::arc(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::communicationMode int  cMode,
string  thisName,
string  thatName
 

Sets the communication mode for this visualisation run.

Parameters:
cMode Mode of communication.
thisName The name of this application on the DBus ipc messaging bus.
thatName The name of Traplas on the Dbus messaging bus.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 202 of file Dispatcher.cpp.

References MessageController::communicationMode(), and mc.

Here is the call graph for this function:

bool Dispatcher::communicationMode int  cMode,
string  filename
 

Sets the communication mode for this visualisation run.

Parameters:
cMode Mode of communication.
filename the name of the file to open.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 197 of file Dispatcher.cpp.

References MessageController::communicationMode(), and mc.

Referenced by parse().

Here is the call graph for this function:

bool Dispatcher::dispatchMessage  ) 
 

Parse any messages present in the queue.

Returns:
true if sucessfull, false if there has been an error.

Definition at line 79 of file Dispatcher.cpp.

References arcparse(), cond_ptr, drvparse(), loadparse(), locationparse(), mutex_ptr, newcargparse(), parseQ, rmcargparse(), setspdparse(), trdelparse(), trnewparse(), and unloadparse().

Referenced by go().

Here is the call graph for this function:

bool Dispatcher::drvparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 221 of file Dispatcher.cpp.

References StateControl::drv(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

double Dispatcher::getTime  ) 
 

Returns:
The time in the visualisation. This is obtained through the MessageController.

Definition at line 215 of file Dispatcher.cpp.

References MessageController::getVisualisationTime(), and mc.

Referenced by StateControl::getTime().

Here is the call graph for this function:

double Dispatcher::getTimeFlow  ) 
 

Returns:
The speed or multiplication factor with which time in the visualisation is changing.

Definition at line 211 of file Dispatcher.cpp.

References MessageController::getTimeFlow(), and mc.

Referenced by StateControl::adjustTimeFlow(), StateControl::drv(), StateControl::getTimeFlow(), AnimationPathTimedCallback::operator()(), and StateControl::pause().

Here is the call graph for this function:

bool Dispatcher::loadparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 251 of file Dispatcher.cpp.

References StateControl::load(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::locationparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 329 of file Dispatcher.cpp.

References StateControl::location(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::newcargparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 413 of file Dispatcher.cpp.

References StateControl::newcarg(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::order int  Ris,
int  Rid,
double  ts,
double  tf
 

Construct a message specifying a new order.

Parameters:
Ris The identifier of the infrastructure resource from where a cargo object needs to be moved.
Rid The idenfifier of the destination of the cargo object.
ts The start of de delivery time window.
tf The deadline for delivery.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 160 of file Dispatcher.cpp.

References mc, and MessageController::sendMessageToComm().

Here is the call graph for this function:

bool Dispatcher::proccessMessageFromMC shared_ptr< vector< shared_ptr< string > > >  msg  ) 
 

Puts a message in the queue to be parsed by the thread that runs in StateControl.

Parameters:
msg Reference to the message.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 67 of file Dispatcher.cpp.

References cond_ptr, mutex_ptr, and parseQ.

Referenced by msgcontrollerThread().

bool Dispatcher::rmcargparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 436 of file Dispatcher.cpp.

References StateControl::rmcarg(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::setSpdInSim int  id,
double  speed,
double  ts,
double  te
 

Construct a message specifying a change in speed for the specified resource.

Parameters:
id The identifier of the transport or infrastructure resource of which the speed is to be changed.
speed The new speed.
ts The time at which the change takes effect.
te The time at which this change stops having effect.
Returns:
true if sucessfull, false if there has been an error.

Definition at line 123 of file Dispatcher.cpp.

References mc, and MessageController::sendMessageToComm().

Here is the call graph for this function:

bool Dispatcher::setspdparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 307 of file Dispatcher.cpp.

References StateControl::setspdinviz(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::setTimeFlow double  flowFactor  ) 
 

Sets the speed at which time is progressing in the visualisation. This is obtained through the MessageController.

Parameters:
flowFactor The new speed at which time progresses.
Returns:
true if succesful, false if there has been an error.

Definition at line 207 of file Dispatcher.cpp.

References mc, and MessageController::setTimeFlow().

Referenced by StateControl::adjustTimeFlow(), and StateControl::pause().

Here is the call graph for this function:

bool Dispatcher::trdelparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 393 of file Dispatcher.cpp.

References StateControl::trdel(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::trnewparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 368 of file Dispatcher.cpp.

References StateControl::trnew(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:

bool Dispatcher::unloadparse shared_ptr< vector< shared_ptr< string > > >   )  [private]
 

Definition at line 279 of file Dispatcher.cpp.

References StateControl::unload(), and world.

Referenced by dispatchMessage().

Here is the call graph for this function:


Member Data Documentation

pthread_cond_t* Dispatcher::cond_ptr [private]
 

Definition at line 119 of file Dispatcher.h.

Referenced by Dispatcher(), dispatchMessage(), and proccessMessageFromMC().

MessageController* Dispatcher::mc [private]
 

Definition at line 115 of file Dispatcher.h.

Referenced by communicationMode(), Dispatcher(), getTime(), getTimeFlow(), order(), setSpdInSim(), setTimeFlow(), and ~Dispatcher().

pthread_mutex_t* Dispatcher::mutex_ptr [private]
 

Definition at line 118 of file Dispatcher.h.

Referenced by Dispatcher(), dispatchMessage(), and proccessMessageFromMC().

shared_ptr< queue< shared_ptr< vector< shared_ptr< string > > > > > Dispatcher::parseQ [private]
 

Definition at line 117 of file Dispatcher.h.

Referenced by Dispatcher(), dispatchMessage(), and proccessMessageFromMC().

StateControl* Dispatcher::world [private]
 

Definition at line 114 of file Dispatcher.h.

Referenced by arcparse(), Dispatcher(), drvparse(), loadparse(), locationparse(), newcargparse(), rmcargparse(), setspdparse(), trdelparse(), trnewparse(), unloadparse(), and ~Dispatcher().


The documentation for this class was generated from the following files:
Generated on Mon Jun 19 10:22:17 2006 for TraplasVisualisation by  doxygen 1.4.4