GRUTinizer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TGRUTint.h
Go to the documentation of this file.
1 #ifndef TGRUTINT_H
2 #define TGRUTINT_H
3 
4 #include <string>
5 #include <queue>
6 
7 #ifndef __CINT__
8 #include <condition_variable>
9 #include <mutex>
10 #include <memory>
11 #endif
12 
13 #include <TSystem.h>
14 #include <TSysEvtHandler.h>
15 #include <TRint.h>
16 #include <TEnv.h>
17 #include <TChain.h>
18 
19 #include "TGRUTServer.h"
20 #include "TPipeline.h"
21 
22 extern TObject* gResponse;
23 
24 class TGRUTint : public TRint {
25 
26 private:
27  TGRUTint(int argc, char **argv, void *opts=0,int numOptions=0,
28  bool noLogo = true, const char *appClassName = "grutinizer");
29 
30  static TEnv *fGRUTEnv;
32 
33 public:
34  static TGRUTint *instance(int argc=0,char **argv=0,void *opts=0,int numOptions=-1,
35  bool noLogo=true,const char *appClassName="grutinizer");
36  virtual ~TGRUTint();
37 
38  virtual void Terminate(Int_t status = 0);
39 
40  Long_t ProcessLine(const char* line, Bool_t sync=kTRUE,Int_t *error=0);
41  TString ReverseObjectSearch(TString&);
42 
43  Int_t TabCompletionHook(char* buf, int* pLoc, std::ostream& out);
44 
45  TFile* OpenRootFile(const std::string& filename,TChain *chain=0);
46 
47  int GetNPipelines();
48  TPipeline* GetPipeline(int i);
49 
50 public:
51  TObject* DelayedProcessLine(std::string message);
52  //GUI interface commands;
53  void OpenFileDialog();
54  void DefaultFunction();
55 
57 
58  void HandleFile(const std::string& filename);
59 
60  private:
61  void RunMacroFile(const std::string& filename);
62  void SetupPipeline();
63 
64 private:
65 #ifndef __CINT__
66  std::mutex fCommandListMutex;
67  std::mutex fResultListMutex;
69  std::condition_variable fNewResult;
70 #endif
71  TTimer* fGuiTimer;
72 
73  TTimer* fCommandTimer;
75  std::queue<std::string> fLinesToProcess;
76  std::queue<TObject*> fCommandResults;
77 
79 
81 
83 
84  void Init();
85  void ApplyOptions();
86  void LoadGRootGraphics();
87 
88  ClassDef(TGRUTint,0);
89 };
90 
91 
92 int GetNPipelines();
93 TPipeline* GetPipeline(int i);
94 
95 class TGRUTInterruptHandler : public TSignalHandler {
96 public:
97  TGRUTInterruptHandler():TSignalHandler(ESignals::kSigInterrupt,false) { }
98  bool Notify();
100 };
101 
102 #endif