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     // Auxiliar
00044     TThread * fDianaThread;
00045     std::string fFileListName;
00046     TMutex * fGUIActionMutex; // protect fCommandList
00047     QGDReceiver::Status fDianaStatus;
00048 
00049   public:
00050     // Ctr, Dtr, initialization
00051     QIGUIDianaSessionHandler (QObject * parent=0);
00052     virtual ~QIGUIDianaSessionHandler();
00053     void Init();
00054 
00055     QIGUISession * GetSession() {return fSession;}
00056 
00057      // QGDMessageHandler methods
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     // Gui Actions
00065     void RefreshModulesParameters();
00066     void RerunDiana();
00067 
00068     std::string GetModule(int index) ;
00069     int GetModule(std::string name); // Return module index in vector (-1 if not found)
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     // Modfy the corresponding value in fParameterList and returns a structure QGDParameter with 
00079     // the modified parameter
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     // Auxiliar
00096     void InitGUIAction(); // Get the lock of fGUIActionMutex
00097     void EndGUIAction(); // Release the lock of fGUIActionMutex
00098     void ClearCommandQueue(); 
00099 
00100     // Maria 150609
00101     protected:
00102     bool fModulesOK;
00103     public:
00104     bool IsModulesOK() {return fModulesOK;}
00105 
00106 
00107 };
00108 
00109 #endif

Generated on Tue Nov 16 10:49:59 2010 for CUORE Software by  doxygen 1.5.6