QIGUIDianaSessionHandler.hh
00001 #ifndef _QIGUI_DIANA_SESSION_HANDLER__H_
00002 #define _QIGUI_DIANA_SESSION_HANDLER__H_
00003
00004 #include <string>
00005 #include <vector>
00006 #include <queue>
00007 #include "QGDMessageHandler.hh"
00008 #include <QGDInclude.hh>
00009
00010
00011 class QIGUISession;
00012 class QIGUIPulseWindow;
00013 class QObject;
00014 class TThread;
00015 class TMutex;
00016
00017 class QIGUIDianaSessionHandler: public QGDMessageHandler
00018 {
00019
00020 private:
00021
00023 QGDModuleList fModulesList;
00024
00026 std::vector <QGDModuleParameterList> fParameterList;
00027
00029 QIGUISession * fSession;
00030
00032 std::queue<QGDCommand> fCommandList;
00033
00035 std::queue<QIGUIPulseWindow*> fSenders;
00036
00038 std::queue<QGDCommand> fParamsToModify;
00039
00041 int fCurrentModule;
00042
00043
00044 TThread * fDianaThread;
00045 std::string fFileListName;
00046 TMutex * fGUIActionMutex;
00047 QGDReceiver::Status fDianaStatus;
00048
00049 public:
00050
00051 QIGUIDianaSessionHandler (QObject * parent=0);
00052 virtual ~QIGUIDianaSessionHandler();
00053 void Init();
00054
00055 QIGUISession * GetSession() {return fSession;}
00056
00057
00058 QGDCommand GetCommand(const QGDCommandList& cmdList) ;
00059 void Display(TObject * obj);
00060 void DisplayModuleList(const QGDModuleList& modList);
00061 void DisplayModuleParameters(const QGDModuleParameterList& paramList);
00062 void NotifyReceiverStatus(QGDReceiver::Status status);
00063
00064
00065 void RefreshModulesParameters();
00066 void RerunDiana();
00067
00068 std::string GetModule(int index) ;
00069 int GetModule(std::string name);
00070 int GetNModules();
00071 int GetCurrentModule() {return fCurrentModule;}
00072 void SetModules(const QGDModuleList & modList);
00073 void ClearModules();
00074 QGDModuleParameterList GetParameterList (int index);
00075 int AddModParameterList(const QGDModuleParameterList& parList);
00076 QGDParameter GetParameter(std::string parName, std::string module, int occurrence = 0);
00077
00078
00079
00080 QGDParameter ModifyParameter (int modIndex, int parIndex, std::string newVal);
00081
00082 void PushBackCommand(QGDCommand cmd);
00083 QGDCommand PopFrontCommand();
00084
00085 void PushBackSender(QIGUIPulseWindow * sender);
00086
00087 void AddParameterToModify(int modIndex, int paramIndex, std::string newVal);
00088 void QueueParametersToModify();
00089
00090 void StartDianaThread();
00091 void StopDiana();
00092 static void *LaunchDiana(void * dianaSessionHandler);
00093 void GenerateFileList();
00094
00095
00096 void InitGUIAction();
00097 void EndGUIAction();
00098 void ClearCommandQueue();
00099
00100
00101 protected:
00102 bool fModulesOK;
00103 public:
00104 bool IsModulesOK() {return fModulesOK;}
00105
00106
00107 };
00108
00109 #endif