GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Slot.h
Go to the documentation of this file.
1 // $Id: TGo4Slot.h 3266 2021-07-12 15:33:01Z linev $
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 TGO4SLOT_H
15 #define TGO4SLOT_H
16 
17 #include "TNamed.h"
18 #include "TObjArray.h"
19 #include "TGo4Proxy.h"
20 
21 class TClass;
22 class TDirectory;
23 class TGo4ObjectManager;
24 
25 class TGo4Slot : public TNamed {
26  protected:
27 
28  enum ESlotBits {
29  kStartDelete = BIT(23)
30  };
31 
32  void CleanProxy();
33 
34  void AddChild(TGo4Slot* child);
35  void RemoveChild(TGo4Slot* child);
36 
38  TObjArray* fChilds;
39  TObjArray fPars;
41  Int_t fAssignFlag;
42  Int_t fAssignCnt;
43 
44  public:
45  enum { evDelete = 0,
46  evCreate = 1,
51  evObjDeleted = 6 };
52 
53  TGo4Slot();
54  TGo4Slot(TGo4Slot* parent);
55  TGo4Slot(TGo4Slot* parent, const char* name, const char* title);
56  virtual ~TGo4Slot();
57 
58  TGo4Slot* GetParent() const { return fParent; }
59  void SetParent(TGo4Slot* parent) { fParent = parent; }
60  Bool_t IsParent(const TGo4Slot* slot) const;
61 
62  virtual void ProduceFullName(TString& name, TGo4Slot* toparent = 0);
63  TString GetFullName(TGo4Slot* toparent = 0);
64  virtual TGo4ObjectManager* GetOM() const;
65 
66  const char* GetInfo();
67  Int_t GetSizeInfo();
68 
69  void SetPar(const char* name, const char* value);
70  const char* GetPar(const char* name) const;
71  void RemovePar(const char* name);
72  void SetIntPar(const char* name, Int_t value);
73  Bool_t GetIntPar(const char* name, Int_t& value);
74  void PrintPars(Int_t level = 3);
75 
76  Int_t NumChilds() const { return fChilds ? fChilds->GetLast()+1 : 0; }
77  TGo4Slot* GetChild(Int_t n) const { return fChilds ? (TGo4Slot*) fChilds->At(n) : 0; }
78  TGo4Slot* FindChild(const char* name);
79  Int_t GetIndexOf(TGo4Slot* child);
81  TGo4Slot* GetNext();
82  void DeleteChild(const char* name);
83  void DeleteChilds(const char* startedwith = 0);
84  virtual void Delete(Option_t *opt = "");
85 
86  TGo4Slot* DefineSubSlot(const char* name, const char* &subname) const;
87  TGo4Slot* GetSlot(const char* name, Bool_t force = kFALSE);
88  TGo4Slot* FindSlot(const char* fullpath, const char** subname = 0);
89  Bool_t ShiftSlotBefore(TGo4Slot* slot, TGo4Slot* before);
90  Bool_t ShiftSlotAfter(TGo4Slot* slot, TGo4Slot* after);
91 
92  void SetProxy(TGo4Proxy* cont);
93  TGo4Proxy* GetProxy() const { return fProxy; }
94 
95  Int_t GetSlotKind() const;
96  const char* GetSlotClassName() const;
97 
98  Bool_t IsAcceptObject(TClass* cl);
99  Bool_t AssignObject(TObject* obj, Bool_t owner);
100  TObject* GetAssignedObject();
101  virtual void Update(Bool_t strong = kFALSE);
102  Int_t GetAssignFlag() const { return fAssignFlag; }
103  void ResetAssignFlag() { fAssignFlag = -1; }
104  Int_t GetAssignCnt() const { return fAssignCnt; }
105 
106  Bool_t HasSubLevels() const;
107  Bool_t HasSlotsSubLevels() const;
108  TGo4LevelIter* MakeLevelIter() const;
109  TGo4Access* ProvideSlotAccess(const char* name);
110 
111  void SaveData(TDirectory* dir, Bool_t onlyobjs = kFALSE);
112  void ReadData(TDirectory* dir);
113 
114  // method required to be virtual for object manager
115  virtual void Event(TGo4Slot* source, Int_t id, void* param = 0);
116  void ForwardEvent(TGo4Slot* source, Int_t id, void* param = 0);
117 
118  virtual void RecursiveRemove(TObject* obj);
119 
120  virtual void Print(Option_t* option) const;
121 
122  static const char* FindFolderSeparator(const char* name);
123  static void ProduceFolderAndName(const char* fullname, TString& foldername, TString& objectname);
124 
125  Bool_t DoingDelete() const { return TestBit(kStartDelete); }
126 
127  ClassDef(TGo4Slot, 1);
128 };
129 
130 
131 #endif
132 
void CleanProxy()
Definition: TGo4Slot.cxx:300
Int_t GetAssignFlag() const
Definition: TGo4Slot.h:102
TGo4Proxy * fProxy
Definition: TGo4Slot.h:40
Bool_t GetIntPar(const char *name, Int_t &value)
Definition: TGo4Slot.cxx:642
void SetParent(TGo4Slot *parent)
Definition: TGo4Slot.h:59
static const char * FindFolderSeparator(const char *name)
Definition: TGo4Slot.cxx:659
void SaveData(TDirectory *dir, Bool_t onlyobjs=kFALSE)
Definition: TGo4Slot.cxx:426
Bool_t HasSubLevels() const
Definition: TGo4Slot.cxx:385
void SetIntPar(const char *name, Int_t value)
Definition: TGo4Slot.cxx:635
ClassDef(TGo4Slot, 1)
void DeleteChild(const char *name)
Definition: TGo4Slot.cxx:204
void SetProxy(TGo4Proxy *cont)
Definition: TGo4Slot.cxx:310
Bool_t HasSlotsSubLevels() const
Definition: TGo4Slot.cxx:392
Int_t GetSlotKind() const
Definition: TGo4Slot.cxx:343
TGo4Slot * FindSlot(const char *fullpath, const char **subname=0)
Definition: TGo4Slot.cxx:485
Int_t GetIndexOf(TGo4Slot *child)
Definition: TGo4Slot.cxx:242
TGo4LevelIter * MakeLevelIter() const
Definition: TGo4Slot.cxx:397
TGo4Proxy * GetProxy() const
Definition: TGo4Slot.h:93
void PrintPars(Int_t level=3)
Definition: TGo4Slot.cxx:650
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:277
const char * GetSlotClassName() const
Definition: TGo4Slot.cxx:348
const char * GetPar(const char *name) const
Definition: TGo4Slot.cxx:617
void ResetAssignFlag()
Definition: TGo4Slot.h:103
void DeleteChilds(const char *startedwith=0)
Definition: TGo4Slot.cxx:218
TGo4Slot()
Definition: TGo4Slot.cxx:61
void RemoveChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:560
virtual void Event(TGo4Slot *source, Int_t id, void *param=0)
Definition: TGo4Slot.cxx:571
Bool_t ShiftSlotBefore(TGo4Slot *slot, TGo4Slot *before)
Definition: TGo4Slot.cxx:521
void AddChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:553
TObject * GetAssignedObject()
Definition: TGo4Slot.cxx:370
virtual void RecursiveRemove(TObject *obj)
Definition: TGo4Slot.cxx:590
TObjArray * fChilds
Definition: TGo4Slot.h:38
Bool_t IsParent(const TGo4Slot *slot) const
Definition: TGo4Slot.cxx:194
TObjArray fPars
Definition: TGo4Slot.h:39
TGo4Slot * FindChild(const char *name)
Definition: TGo4Slot.cxx:259
TGo4Slot * GetParent() const
Definition: TGo4Slot.h:58
virtual void Update(Bool_t strong=kFALSE)
Definition: TGo4Slot.cxx:375
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
Definition: TGo4Slot.cxx:467
Bool_t ShiftSlotAfter(TGo4Slot *slot, TGo4Slot *after)
Definition: TGo4Slot.cxx:537
Int_t fAssignCnt
use in object manager to poll until object is assigned
Definition: TGo4Slot.h:42
void RemovePar(const char *name)
Definition: TGo4Slot.cxx:624
TGo4Slot * DefineSubSlot(const char *name, const char *&subname) const
Definition: TGo4Slot.cxx:447
TGo4Slot * GetNextChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:251
Bool_t DoingDelete() const
Definition: TGo4Slot.h:125
const char * GetInfo()
Definition: TGo4Slot.cxx:326
virtual ~TGo4Slot()
Definition: TGo4Slot.cxx:107
void ReadData(TDirectory *dir)
Definition: TGo4Slot.cxx:432
TGo4Slot * fParent
Definition: TGo4Slot.h:37
static void ProduceFolderAndName(const char *fullname, TString &foldername, TString &objectname)
Definition: TGo4Slot.cxx:664
void ForwardEvent(TGo4Slot *source, Int_t id, void *param=0)
Definition: TGo4Slot.cxx:581
virtual void Delete(Option_t *opt="")
Definition: TGo4Slot.cxx:187
Int_t fAssignFlag
Definition: TGo4Slot.h:41
virtual void Print(Option_t *option) const
Definition: TGo4Slot.cxx:597
Bool_t AssignObject(TObject *obj, Bool_t owner)
Definition: TGo4Slot.cxx:358
Int_t NumChilds() const
Definition: TGo4Slot.h:76
TString GetFullName(TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:287
Int_t GetSizeInfo()
Definition: TGo4Slot.cxx:335
virtual TGo4ObjectManager * GetOM() const
Definition: TGo4Slot.cxx:295
void SetPar(const char *name, const char *value)
Definition: TGo4Slot.cxx:605
TGo4Access * ProvideSlotAccess(const char *name)
Definition: TGo4Slot.cxx:409
TGo4Slot * GetChild(Int_t n) const
Definition: TGo4Slot.h:77
Int_t GetAssignCnt() const
Definition: TGo4Slot.h:104
Bool_t IsAcceptObject(TClass *cl)
Definition: TGo4Slot.cxx:353
TGo4Slot * GetNext()
Definition: TGo4Slot.cxx:271