GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4MainTree.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 TGO4MAINTREE_H
15 #define TGO4MAINTREE_H
16 
17 #include "TObject.h"
18 
19 class TTree;
20 class TFile;
21 
32 class TGo4MainTree : public TObject {
33  friend class TGo4TreeSource;
34  friend class TGo4TreeStore;
35 
36  protected:
39  TTree *GetTree() const { return fxTree; }
40 
41  TGo4MainTree();
42 
43  public:
44 
45  virtual ~TGo4MainTree();
46 
48  static const char *fgcTREENAME;
49 
51  static const char *fgcFILENAME;
52 
54  static const Int_t fgiCOMPRESS;
55 
57  static const Int_t fgiAUTOSAVESIZE;
58 
59  static TGo4MainTree *Instance();
60 
64  static Bool_t Exists() { return fxInstance != nullptr; }
65 
66  Int_t GetCurrentIndex() const { return fiCurrentIndex; }
67 
71  Int_t IncCurrentIndex() { return ++fiCurrentIndex; }
72 
73  void SetCurrentIndex(Int_t number = 0) { fiCurrentIndex = number; }
74 
75  Int_t GetMaxIndex();
76 
78  void SetAutoSave(Int_t bytesinterval);
79 
83  void Update();
84 
86  Int_t Write(const char *dummy = nullptr, Int_t option = 0, Int_t bufsize = 0) override;
87  Int_t Write(const char *dummy = nullptr, Int_t option = 0, Int_t bufsize = 0) const override;
88 
89  private:
90 
92 
93  TFile *fxFile{nullptr};
94 
95  TTree *fxTree{nullptr};
96 
99  Int_t fiMaxIndex{0};
100 
102  Int_t fiCurrentIndex{0};
103 
104  ClassDefOverride(TGo4MainTree,1)
105 };
106 
107 #endif //TGO4MAINTREE_H
static TGo4MainTree * Instance()
Int_t fiCurrentIndex
Definition: TGo4MainTree.h:102
static const Int_t fgiCOMPRESS
Definition: TGo4MainTree.h:54
void SetAutoSave(Int_t bytesinterval)
Int_t GetMaxIndex()
Int_t IncCurrentIndex()
Definition: TGo4MainTree.h:71
virtual ~TGo4MainTree()
static Bool_t Exists()
Definition: TGo4MainTree.h:64
Int_t Write(const char *dummy=nullptr, Int_t option=0, Int_t bufsize=0) override
TTree * fxTree
Definition: TGo4MainTree.h:95
TFile * fxFile
Definition: TGo4MainTree.h:93
static const char * fgcTREENAME
Definition: TGo4MainTree.h:48
Int_t GetCurrentIndex() const
Definition: TGo4MainTree.h:66
static TGo4MainTree * fxInstance
Definition: TGo4MainTree.h:91
Int_t fiMaxIndex
Definition: TGo4MainTree.h:99
static const char * fgcFILENAME
Definition: TGo4MainTree.h:51
void SetCurrentIndex(Int_t number=0)
Definition: TGo4MainTree.h:73
TTree * GetTree() const
Definition: TGo4MainTree.h:39
static const Int_t fgiAUTOSAVESIZE
Definition: TGo4MainTree.h:57