GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4BrowserProxy.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4BROWSERPROXY_H
15 #define TGO4BROWSERPROXY_H
16 
17 #include "TGo4Proxy.h"
18 
19 #include "TString.h"
20 
21 class TList;
22 class TTimer;
23 class TAxis;
24 class TGraph;
25 
26 class TGo4ObjectManager;
27 class TGo4AnalysisProxy;
28 class TGo4ServerProxy;
29 class TGo4Picture;
30 class TVirtualTreePlayer;
31 
32 class TGo4BrowserProxy : public TGo4Proxy {
33  public:
35  TGo4BrowserProxy(const char *datapath,
36  const char *viewpath,
37  Bool_t withRootBrowser = kFALSE);
38  virtual ~TGo4BrowserProxy();
39 
40  void Initialize(TGo4Slot *slot) override;
41  void Finalize(TGo4Slot *slot) override;
42 
43  Bool_t Use() const override { return kFALSE; }
44 
45  Bool_t ProcessEvent(TGo4Slot *slot, TGo4Slot *source, Int_t id, void *param) override;
46  Int_t GetObjectKind() const override { return TGo4Access::kndFolder; }
47  const char *GetContainedClassName() const override { return ClassName(); }
48  TObject *GetAssignedObject() override { return this; }
49 
50  // browser functionality
51 
52  void DataSlotName(const char *item, TString &res) const;
53  void BrowserSlotName(const char *item, TString &res) const;
54  TGo4Slot *BrowserSlot(const char *item = nullptr);
55  TGo4Slot *DataSlot(const char *item);
57  Bool_t BrowserItemName(TGo4Slot *itemslot, TString &res);
58 
59  void UpdateBrowserContent();
60  void InformBrowserUpdate();
61  void SetItemsFilter(Int_t filter); // 0 - all, 1 - fetched, 2 - monitored
62  Int_t GetItemFilter() const { return fiFilterIndex; }
63 
64  Int_t RequestBrowserObject(const char *name, Int_t wait_time = 0);
65  Int_t RequestBrowserObject(TGo4Slot *slot, Int_t wait_time = 0);
66 
67  void AddServerProxy(TGo4ServerProxy *serv, const char *slotname, const char *info);
68  void OpenFile(const char *fname);
69  Bool_t ConnectHServer(const char *servername,
70  Int_t portnumber,
71  const char *basename,
72  const char *userpass,
73  const char *filter);
74  Bool_t ConnectDabc(const char *nodename);
75 
76  void MakeFilesList(TObjArray *arr);
77  void MakeDabcList(TObjArray *arr);
78  void MakeHttpList(TObjArray *arr);
79  void MakeHServerList(TObjArray *arr);
80 
81  Bool_t ProduceExplicitCopy(const char *itemname, const char *tgtpath = nullptr, Bool_t forcerequest = kFALSE);
82  Bool_t ProduceExplicitCopy(TGo4Slot *itemslot, const char *tgtpath = nullptr, Bool_t forcerequest = kFALSE);
83 
84  void ClearClipboard();
85  void AddToClipboard(const char *itemname);
86  Bool_t IsClipboard() const;
87  void CopyClipboard(const char *tgtpath, Bool_t forcerequest = kFALSE);
88 
89  void CreateMemorySubfolder(const char *itemname, const char *newfoldername);
90  void RenameMemoryItem(const char *itemname, const char *newname);
91  void ClearMemoryItem(const char *itemname);
92 
93  void RequestObjectStatus(const char *name, TGo4Slot *tgtslot);
94 
95  void PerformTreeDraw(const char *treename,
96  const char *Xexp,
97  const char *Yexp,
98  const char *Zexp,
99  const char *cutcond,
100  const char *hname,
101  TString &createdhistoname);
102 
103  TString SaveToMemory(const char *pathname, TObject *obj, Bool_t ownership, Bool_t overwrite = kFALSE);
104  void CreateMemoryFolder(const char *foldername = nullptr);
105 
106  void Scan_gROOT();
107 
108  Bool_t SaveBrowserToFile(const char *filename,
109  Bool_t prefetch = kFALSE,
110  const char *selectedpath = nullptr,
111  const char *description = nullptr);
112  void ExportItemsTo(TObjArray *items, // array of TObjString
113  Bool_t fetchitems,
114  const char *filename,
115  const char *filedir,
116  const char *format,
117  const char *description);
118 
119  TObject *GetBrowserObject(const char *name, Int_t update = 0);
120 
121  Bool_t DeleteDataSource(TGo4Slot *itemslot);
122 
123  void DoItemMonitor(TGo4Slot *slot);
124 
126  TGo4Slot *ItemSlot(const char *itemname);
127 
128  Bool_t DefineTreeName(const char *itemname, TString &treename);
129  Bool_t DefineLeafName(const char *itemname, const char *treename, TString &leafname);
130 
131  TGo4Slot *FindServerSlot(Bool_t databranch, Int_t kind = 0);
132  TGo4AnalysisProxy *FindAnalysis(const char *itemname = nullptr);
133  TGo4ServerProxy *FindServer(const char *itemname = nullptr, Bool_t asanalysis = kTRUE);
134  TString FindItemInAnalysis(const char *objname);
135  TString FindItem(const char *objname);
136  void FetchItem(const char *itemname, Int_t wait_time = 0);
137  void RedrawItem(const char *itemname);
138 
139  Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath);
140  Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath);
141  Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder = nullptr);
142 
143  Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj = nullptr);
144 
145  Bool_t DefineRelatedObject(const char *itemname, const char *objectname, TString &objectitem, Int_t mask = 3);
146 
147  Bool_t IsItemRemote(const char *name);
148  Bool_t IsItemRemote(TGo4Slot *slot) const;
149  Bool_t IsAnalysisItem(const char *name);
150 
151  static void SetItemTimeDate(TGo4Slot *slot, const char *stime = nullptr, const char *sdate = nullptr);
152  static const char *ItemTime(TGo4Slot *slot);
153  static const char *ItemDate(TGo4Slot *slot);
154 
155  static void SetLinkedName(TGo4Slot *slot, const char *itemname);
156  static const char *GetLinkedName(TGo4Slot *slot);
157 
158  void SetCanDelete(TGo4Slot *slot, Bool_t on = kTRUE);
159  Bool_t IsCanDelete(TGo4Slot *slot) const;
160 
161  Int_t ItemKind(const char *name);
162  static Int_t ItemKind(TGo4Slot *slot);
163  void SetItemKind(TGo4Slot *slot, Int_t kind, const char *classname, const char *info, Int_t sizeinfo);
164  static const char *ItemInfo(TGo4Slot *slot);
165  Int_t ItemSizeInfo(TGo4Slot *slot);
166 
167  void SetCalcSize(TGo4Slot *slot, Int_t size);
168  Int_t GetCalcSize(TGo4Slot *slot);
169 
170  TClass *ItemClass(const char *name);
171  TClass *ItemClass(TGo4Slot *slot);
172  const char *ItemClassName(const char *name);
173  static const char *ItemClassName(TGo4Slot *slot);
174 
175  Int_t ItemCanDo(const char *name);
176  Int_t ItemCanDo(TGo4Slot *slot);
177  static void SetItemCanDo(TGo4Slot *slot, Int_t cando);
178 
179  Bool_t IsItemMonitored(TGo4Slot *slot) const;
180  void SetItemMonitored(TGo4Slot *slot, Bool_t on = kTRUE);
181 
182  void SetProtectionBits(TGo4Slot *slot, Int_t delprot, Int_t clearprot);
183  void GetProtectionBits(TGo4Slot *slot, Int_t &delprot, Int_t &clearprot);
184 
185  void ToggleMonitoring(Int_t period);
186  void SetMonitorBlockingFlag(Bool_t blocked = kFALSE) { fbBlockMonitoring = blocked; }
187  Int_t MonitoringPeriod() const { return fiMonitoringPeriod; }
188  Int_t UpdateVisibleAnalysisObjects(bool checkmonitor);
190 
191  TGo4ServerProxy *DefineServerProxy(const char *itemname);
192  TGo4ServerProxy *DefineServerObject(const char *itemname, TString *objname = nullptr, Bool_t onlyanalysis = kTRUE);
193  TGo4ServerProxy *DefineAnalysisObject(const char *itemname, TString &analysisname);
194 
195  static bool CanExecuteItem(int cando);
196  static bool CanExpandItem(int cando);
197  static bool CanExportItem(int cando);
198  static bool CanInfoItem(int cando);
199  static bool CanCloseItem(int cando);
200  static bool CanClearItem(int cando);
201  static bool CanDrawItem(int cando);
202  static bool CanDragItem(int cando);
203  static bool CanEditItem(int cando);
204 
205  static Int_t DefineItemProperties(Int_t kind, TClass *cl, TString &pixmap);
206  static Bool_t UpdateObjectContent(TObject *obj, TObject *newobj, Int_t *hasrebinx = nullptr, Int_t *hasrebiny = nullptr);
207 
208  void SyncBrowserSlots();
209 
210  Bool_t HandleTimer(TTimer *timer) override;
211 
212  protected:
213 
214  void UpdateAllCanvases();
215 
216  void AddWaitingList(TGo4Slot *itemslot, const char *destination = nullptr);
217  void CheckWaitingList(TGo4Slot *source);
218 
219  static Int_t CompareAxis(TAxis *ax1, TAxis *ax2);
220  static Bool_t CompareAxisValues(Double_t v1, Double_t v2, Double_t scale);
221 
222  Int_t CalculateFolderSizes(TGo4Slot *topslot);
223 
224  void CheckPictureMonitor(TGo4Slot *slot);
225  void CheckPictureMonitor(TGo4Picture *pic, const char *picitemname);
226 
227  static void SaveAxisTimeProperties(TGraph *gr, Bool_t& timedisplay, TString &format);
228  static void RestoreAxisTimeProperties(TGraph *gr, Bool_t& timedisplay, TString &format);
229 
231  static void UpdateListOfFunctions(TGraph *oldgr, TGraph *newgr);
232 
233  TString fxDataPath;
234  TString fxBrowserPath;
235  TString fxViewPath;
236  Bool_t fbWithRootBrowser{kFALSE};
237  TString fxMemoryPath;
241  TTimer *fxMonitorTimer{nullptr};
242  Bool_t fbBlockMonitoring{kFALSE};
243  Int_t fiFilterIndex{0};
244  TList *fxWaitingList{nullptr};
245  TObjArray *fxClipboard{nullptr};
246  TTimer *fxSyncTimer{nullptr};
247  Bool_t fbBlockSync{kFALSE};
248  TVirtualTreePlayer *fDummyTreePlayer{nullptr};
249 
251 };
252 
253 #endif
static bool CanClearItem(int cando)
void SetCanDelete(TGo4Slot *slot, Bool_t on=kTRUE)
Bool_t ProcessEvent(TGo4Slot *slot, TGo4Slot *source, Int_t id, void *param) override
static void RestoreAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
static void SetItemTimeDate(TGo4Slot *slot, const char *stime=nullptr, const char *sdate=nullptr)
void OpenFile(const char *fname)
static void SaveAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
void MakeHttpList(TObjArray *arr)
TString FindItem(const char *objname)
TString SaveToMemory(const char *pathname, TObject *obj, Bool_t ownership, Bool_t overwrite=kFALSE)
TObject * GetBrowserObject(const char *name, Int_t update=0)
void CheckPictureMonitor(TGo4Slot *slot)
Int_t MonitoringPeriod() const
void ExportItemsTo(TObjArray *items, Bool_t fetchitems, const char *filename, const char *filedir, const char *format, const char *description)
void CreateMemoryFolder(const char *foldername=nullptr)
TGo4ServerProxy * DefineServerObject(const char *itemname, TString *objname=nullptr, Bool_t onlyanalysis=kTRUE)
Bool_t IsItemMonitored(TGo4Slot *slot) const
Int_t ItemKind(const char *name)
Bool_t DefineLeafName(const char *itemname, const char *treename, TString &leafname)
void AddWaitingList(TGo4Slot *itemslot, const char *destination=nullptr)
Bool_t IsItemRemote(const char *name)
static bool CanDrawItem(int cando)
Int_t UpdateVisibleAnalysisObjects(bool checkmonitor)
void RenameMemoryItem(const char *itemname, const char *newname)
void Finalize(TGo4Slot *slot) override
void SetProtectionBits(TGo4Slot *slot, Int_t delprot, Int_t clearprot)
Int_t ItemCanDo(const char *name)
Bool_t DeleteDataSource(TGo4Slot *itemslot)
void MakeHServerList(TObjArray *arr)
TGo4AnalysisProxy * FindAnalysis(const char *itemname=nullptr)
Bool_t IsAnalysisItem(const char *name)
void PerformTreeDraw(const char *treename, const char *Xexp, const char *Yexp, const char *Zexp, const char *cutcond, const char *hname, TString &createdhistoname)
static Bool_t CompareAxisValues(Double_t v1, Double_t v2, Double_t scale)
static bool CanExecuteItem(int cando)
void DoItemMonitor(TGo4Slot *slot)
TClass * ItemClass(const char *name)
Bool_t HandleTimer(TTimer *timer) override
static bool CanExpandItem(int cando)
Int_t RequestBrowserObject(const char *name, Int_t wait_time=0)
static Int_t CompareAxis(TAxis *ax1, TAxis *ax2)
TGo4Slot * BrowserSlot(const char *item=nullptr)
TGo4Slot * fxBrowserSlot
void CheckWaitingList(TGo4Slot *source)
TGo4ObjectManager * fxOM
TGo4Slot * FindServerSlot(Bool_t databranch, Int_t kind=0)
Bool_t ConnectHServer(const char *servername, Int_t portnumber, const char *basename, const char *userpass, const char *filter)
void CreateMemorySubfolder(const char *itemname, const char *newfoldername)
TGo4Slot * DataSlot(const char *item)
const char * GetContainedClassName() const override
static Bool_t UpdateObjectContent(TObject *obj, TObject *newobj, Int_t *hasrebinx=nullptr, Int_t *hasrebiny=nullptr)
static const char * ItemInfo(TGo4Slot *slot)
static bool CanDragItem(int cando)
Int_t CalculateFolderSizes(TGo4Slot *topslot)
void CopyClipboard(const char *tgtpath, Bool_t forcerequest=kFALSE)
Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj=nullptr)
static bool CanExportItem(int cando)
void Initialize(TGo4Slot *slot) override
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
Bool_t IsClipboard() const
void ClearMemoryItem(const char *itemname)
Int_t ItemSizeInfo(TGo4Slot *slot)
void MakeFilesList(TObjArray *arr)
void DataSlotName(const char *item, TString &res) const
void MakeDabcList(TObjArray *arr)
static const char * ItemDate(TGo4Slot *slot)
Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder=nullptr)
Bool_t IsCanDelete(TGo4Slot *slot) const
TObject * GetAssignedObject() override
void RequestObjectStatus(const char *name, TGo4Slot *tgtslot)
TString FindItemInAnalysis(const char *objname)
const char * ItemClassName(const char *name)
TVirtualTreePlayer * fDummyTreePlayer
void SetMonitorBlockingFlag(Bool_t blocked=kFALSE)
void AddToClipboard(const char *itemname)
void FetchItem(const char *itemname, Int_t wait_time=0)
Bool_t DefineRelatedObject(const char *itemname, const char *objectname, TString &objectitem, Int_t mask=3)
Int_t GetCalcSize(TGo4Slot *slot)
void SetItemMonitored(TGo4Slot *slot, Bool_t on=kTRUE)
Int_t GetObjectKind() const override
TGo4Slot * BrowserMemorySlot()
Bool_t ConnectDabc(const char *nodename)
void RedrawItem(const char *itemname)
static bool CanCloseItem(int cando)
static const char * GetLinkedName(TGo4Slot *slot)
Bool_t DefineTreeName(const char *itemname, TString &treename)
void GetProtectionBits(TGo4Slot *slot, Int_t &delprot, Int_t &clearprot)
TGo4ServerProxy * DefineServerProxy(const char *itemname)
static void SetItemCanDo(TGo4Slot *slot, Int_t cando)
TGo4Slot * BrowserTopSlot()
void AddServerProxy(TGo4ServerProxy *serv, const char *slotname, const char *info)
void SetCalcSize(TGo4Slot *slot, Int_t size)
void SetItemKind(TGo4Slot *slot, Int_t kind, const char *classname, const char *info, Int_t sizeinfo)
static bool CanInfoItem(int cando)
static void SetLinkedName(TGo4Slot *slot, const char *itemname)
TGo4ServerProxy * DefineAnalysisObject(const char *itemname, TString &analysisname)
Bool_t ProduceExplicitCopy(const char *itemname, const char *tgtpath=nullptr, Bool_t forcerequest=kFALSE)
void BrowserSlotName(const char *item, TString &res) const
ClassDefOverride(TGo4BrowserProxy, 1)
to overcome problem in ROOT
Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath)
void SetItemsFilter(Int_t filter)
TObjArray * fxClipboard
static const char * ItemTime(TGo4Slot *slot)
static void UpdateListOfFunctions(TGraph *oldgr, TGraph *newgr)
TGo4ServerProxy * FindServer(const char *itemname=nullptr, Bool_t asanalysis=kTRUE)
static bool CanEditItem(int cando)
Bool_t Use() const override
Bool_t BrowserItemName(TGo4Slot *itemslot, TString &res)
TGo4Slot * ItemSlot(const char *itemname)
static Int_t DefineItemProperties(Int_t kind, TClass *cl, TString &pixmap)
void ToggleMonitoring(Int_t period)
Bool_t SaveBrowserToFile(const char *filename, Bool_t prefetch=kFALSE, const char *selectedpath=nullptr, const char *description=nullptr)
Int_t GetItemFilter() const