GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4BrowserProxy.h
Go to the documentation of this file.
1 // $Id: TGo4BrowserProxy.h 2015 2017-10-23 14:38:40Z adamczew $
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 für 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 TGO4PANELCONTAINER_H
15 #define TGO4PANELCONTAINER_H
16 
17 #include "TGo4Proxy.h"
18 
19 #include "TString.h"
20 
21 class TList;
22 class TTimer;
23 
24 class TGo4ObjectManager;
25 class TGo4AnalysisProxy;
26 class TGo4ServerProxy;
27 class TGo4Picture;
28 class TAxis;
29 class TVirtualTreePlayer;
30 class TGraph;
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  virtual void Initialize(TGo4Slot* slot);
41  virtual void Finalize(TGo4Slot* slot);
42 
43  virtual Bool_t Use() const { return kFALSE; }
44 
45  virtual Bool_t ProcessEvent(TGo4Slot* slot, TGo4Slot* source, Int_t id, void* param);
46  virtual Int_t GetObjectKind() { return TGo4Access::kndFolder; }
47  virtual const char* GetContainedClassName() { return ClassName(); }
48  virtual TObject* GetAssignedObject() { return this; }
49 
50  // browser functionality
51 
52  void DataSlotName(const char* item, TString& res);
53  void BrowserSlotName(const char* item, TString& res);
54  TGo4Slot* BrowserSlot(const char* item);
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 = 0, Bool_t forcerequest = kFALSE);
82  Bool_t ProduceExplicitCopy(TGo4Slot* itemslot, const char* tgtpath = 0, Bool_t forcerequest = kFALSE);
83 
84  void ClearClipboard();
85  void AddToClipboard(const char* itemname);
86  Bool_t IsClipboard();
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 = 0);
105 
106  void Scan_gROOT();
107 
108  Bool_t SaveBrowserToFile(const char* filename,
109  Bool_t prefetch = kFALSE,
110  const char* selectedpath = 0,
111  const char* description = 0);
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 = 0);
133  TGo4ServerProxy* FindServer(const char* itemname = 0, 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 = 0);
142 
143  Bool_t UpdateAnalysisItem(const char* itemname, TObject* obj = 0);
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);
149  Bool_t IsAnalysisItem(const char* name);
150 
151  static void SetItemTimeDate(TGo4Slot* slot, const char* stime = 0, const char* sdate = 0);
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);
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);
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 = 0, 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 = 0, Int_t* hasrebiny = 0);
207 
208  void SyncBrowserSlots();
209 
210  virtual Bool_t HandleTimer(TTimer* timer);
211 
212  protected:
213 
214  void UpdateAllCanvases();
215 
216  void AddWaitingList(TGo4Slot* itemslot, const char* destination = 0);
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 
234  TString fxDataPath;
235  TString fxBrowserPath;
236  TString fxViewPath;
238  TString fxMemoryPath;
242  TTimer* fxMonitorTimer;
245  TList* fxWaitingList;
246  TObjArray* fxClipboard;
247  TTimer* fxSyncTimer;
248  Bool_t fbBlockSync;
249  TVirtualTreePlayer* fDummyTreePlayer;
250 
252 };
253 
254 #endif
static bool CanClearItem(int cando)
void SetCanDelete(TGo4Slot *slot, Bool_t on=kTRUE)
static void RestoreAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
ClassDef(TGo4BrowserProxy, 1)
to overcome problem in ROOT
void OpenFile(const char *fname)
static void SaveAxisTimeProperties(TGraph *gr, Bool_t &timedisplay, TString &format)
Bool_t IsItemMonitored(TGo4Slot *slot)
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)
void DataSlotName(const char *item, TString &res)
void ExportItemsTo(TObjArray *items, Bool_t fetchitems, const char *filename, const char *filedir, const char *format, const char *description)
Int_t ItemKind(const char *name)
static Bool_t UpdateObjectContent(TObject *obj, TObject *newobj, Int_t *hasrebinx=0, Int_t *hasrebiny=0)
virtual void Initialize(TGo4Slot *slot)
Bool_t DefineLeafName(const char *itemname, const char *treename, TString &leafname)
Bool_t IsItemRemote(const char *name)
static bool CanDrawItem(int cando)
Int_t UpdateVisibleAnalysisObjects(bool checkmonitor)
void RenameMemoryItem(const char *itemname, const char *newname)
virtual TObject * GetAssignedObject()
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)
TGo4ServerProxy * DefineServerObject(const char *itemname, TString *objname=0, Bool_t onlyanalysis=kTRUE)
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)
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 * fxBrowserSlot
void CheckWaitingList(TGo4Slot *source)
TGo4ObjectManager * fxOM
void AddWaitingList(TGo4Slot *itemslot, const char *destination=0)
TGo4Slot * FindServerSlot(Bool_t databranch, Int_t kind=0)
TGo4ServerProxy * FindServer(const char *itemname=0, Bool_t asanalysis=kTRUE)
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)
virtual Bool_t HandleTimer(TTimer *timer)
Bool_t SaveBrowserToFile(const char *filename, Bool_t prefetch=kFALSE, const char *selectedpath=0, const char *description=0)
virtual void Finalize(TGo4Slot *slot)
TGo4Slot * DataSlot(const char *item)
static const char * ItemInfo(TGo4Slot *slot)
static bool CanDragItem(int cando)
Bool_t IsCanDelete(TGo4Slot *slot)
Int_t CalculateFolderSizes(TGo4Slot *topslot)
void CopyClipboard(const char *tgtpath, Bool_t forcerequest=kFALSE)
static bool CanExportItem(int cando)
Bool_t DefineFileObject(const char *itemname, TString &filedataslot, const char **filepath)
void CreateMemoryFolder(const char *foldername=0)
void ClearMemoryItem(const char *itemname)
Int_t ItemSizeInfo(TGo4Slot *slot)
void MakeFilesList(TObjArray *arr)
Int_t GetItemFilter() const
void MakeDabcList(TObjArray *arr)
static const char * ItemDate(TGo4Slot *slot)
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)
TGo4Slot * BrowserSlot(const char *item)
void SetItemMonitored(TGo4Slot *slot, Bool_t on=kTRUE)
TGo4Slot * BrowserMemorySlot()
Bool_t ProduceExplicitCopy(const char *itemname, const char *tgtpath=0, Bool_t forcerequest=kFALSE)
virtual Int_t GetObjectKind()
Bool_t ConnectDabc(const char *nodename)
void RedrawItem(const char *itemname)
static bool CanCloseItem(int cando)
TGo4AnalysisProxy * FindAnalysis(const char *itemname=0)
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)
virtual Bool_t ProcessEvent(TGo4Slot *slot, TGo4Slot *source, Int_t id, void *param)
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)
virtual const char * GetContainedClassName()
Bool_t UpdateObjectInFile(const char *itemname, const char *fileslotname, const char *filepath)
void SetItemsFilter(Int_t filter)
virtual Bool_t Use() const
TObjArray * fxClipboard
Int_t MonitoringPeriod() const
static const char * ItemTime(TGo4Slot *slot)
static void UpdateListOfFunctions(TGraph *oldgr, TGraph *newgr)
Bool_t UpdateAnalysisItem(const char *itemname, TObject *obj=0)
static bool CanEditItem(int cando)
Bool_t BrowserItemName(TGo4Slot *itemslot, TString &res)
static void SetItemTimeDate(TGo4Slot *slot, const char *stime=0, const char *sdate=0)
TGo4Slot * ItemSlot(const char *itemname)
static Int_t DefineItemProperties(Int_t kind, TClass *cl, TString &pixmap)
void ToggleMonitoring(Int_t period)
Bool_t SaveItemToFile(const char *itemname, const char *filename, const char *subfolder=0)
void BrowserSlotName(const char *item, TString &res)