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

include/MessageController.h

Go to the documentation of this file.
00001 
00017 #define MESSAGECONTROLLER_H 1
00018 
00019 #ifndef _GLIBCXX_LIST
00020 #include <list>
00021 #endif
00022 
00023 #ifndef _GLIBCXX_VECTOR
00024 #include <vector>
00025 #endif
00026 
00027 #ifndef _GLIBCXX_STRING
00028 #include <string>
00029 #endif
00030 
00031 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
00032 #include <boost/shared_ptr.hpp>
00033 #endif
00034 
00035 #include <pthread.h>
00036 
00037 using namespace boost;
00038 using namespace std;
00039 
00040 //forward declarations:
00041 class Dispatcher;
00042 class Comm;
00043 
00049 class MessageController{
00050         private:
00051         Comm *comm;
00052         Dispatcher* disp;
00053 
00054         int cmode;                                      //      Communication mode.
00055 
00056         shared_ptr< list< shared_ptr< vector< shared_ptr< string > > > > > msgqueue;    //      Queue with messages.
00057         pthread_mutex_t mutex;
00058         pthread_cond_t cond;
00059 
00060         double currenttime;                     //      The current time of the visualisation.
00061         double timeflowfactor;          //      The speed of the the visualisation.
00062 
00063         pthread_t msgcontrollerthread;
00064         bool msgcontrollerthread_run;
00065 
00066         public:
00071         MessageController(Dispatcher *dp);
00072         ~MessageController();
00073 
00077         inline double getVisualisationTime(){ return currenttime / 1000; }
00083         bool processMessageFromComm(shared_ptr< vector< shared_ptr< string > > > messagebody);
00089         bool sendMessageToComm(shared_ptr< vector< shared_ptr< string > > > messagebody);
00096         bool communicationMode(int cMode, string filename);
00104         bool communicationMode(int cMode, string thisname, string thatname);
00110         bool setTimeFlow(double ntimeflowfactor);
00114         inline double getTimeFlow(){ return timeflowfactor; }
00119         friend void* msgcontrollerThread( void * args );
00120 };

Generated on Mon Jun 19 10:22:04 2006 for TraplasVisualisation by  doxygen 1.4.4