GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Slot.h
Go to the documentation of this file.
1 // $Id: TGo4Slot.h 1461 2015-05-29 11:12:14Z 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 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 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!=0) ? fChilds->GetLast()+1 : 0; }
77  TGo4Slot* GetChild(Int_t n) const { return (fChilds!=0) ? (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:303
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:646
void SetParent(TGo4Slot *parent)
Definition: TGo4Slot.h:59
static const char * FindFolderSeparator(const char *name)
Definition: TGo4Slot.cxx:663
void SaveData(TDirectory *dir, Bool_t onlyobjs=kFALSE)
Definition: TGo4Slot.cxx:430
Bool_t HasSubLevels() const
Definition: TGo4Slot.cxx:389
void SetIntPar(const char *name, Int_t value)
Definition: TGo4Slot.cxx:639
ClassDef(TGo4Slot, 1)
void DeleteChild(const char *name)
Definition: TGo4Slot.cxx:207
void SetProxy(TGo4Proxy *cont)
Definition: TGo4Slot.cxx:313
Bool_t HasSlotsSubLevels() const
Definition: TGo4Slot.cxx:396
Int_t GetSlotKind() const
Definition: TGo4Slot.cxx:346
TGo4Slot * FindSlot(const char *fullpath, const char **subname=0)
Definition: TGo4Slot.cxx:489
Int_t GetIndexOf(TGo4Slot *child)
Definition: TGo4Slot.cxx:245
TGo4LevelIter * MakeLevelIter() const
Definition: TGo4Slot.cxx:401
TGo4Proxy * GetProxy() const
Definition: TGo4Slot.h:93
void PrintPars(Int_t level=3)
Definition: TGo4Slot.cxx:654
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:280
const char * GetSlotClassName() const
Definition: TGo4Slot.cxx:351
const char * GetPar(const char *name) const
Definition: TGo4Slot.cxx:621
void ResetAssignFlag()
Definition: TGo4Slot.h:103
void DeleteChilds(const char *startedwith=0)
Definition: TGo4Slot.cxx:221
TGo4Slot()
Definition: TGo4Slot.cxx:64
void RemoveChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:564
virtual void Event(TGo4Slot *source, Int_t id, void *param=0)
Definition: TGo4Slot.cxx:575
Bool_t ShiftSlotBefore(TGo4Slot *slot, TGo4Slot *before)
Definition: TGo4Slot.cxx:525
void AddChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:557
TObject * GetAssignedObject()
Definition: TGo4Slot.cxx:373
virtual void RecursiveRemove(TObject *obj)
Definition: TGo4Slot.cxx:594
TObjArray * fChilds
Definition: TGo4Slot.h:38
Bool_t IsParent(const TGo4Slot *slot) const
Definition: TGo4Slot.cxx:197
TObjArray fPars
Definition: TGo4Slot.h:39
TGo4Slot * FindChild(const char *name)
Definition: TGo4Slot.cxx:262
TGo4Slot * GetParent() const
Definition: TGo4Slot.h:58
virtual void Update(Bool_t strong=kFALSE)
Definition: TGo4Slot.cxx:379
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
Definition: TGo4Slot.cxx:471
Bool_t ShiftSlotAfter(TGo4Slot *slot, TGo4Slot *after)
Definition: TGo4Slot.cxx:541
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:628
TGo4Slot * DefineSubSlot(const char *name, const char *&subname) const
Definition: TGo4Slot.cxx:451
TGo4Slot * GetNextChild(TGo4Slot *child)
Definition: TGo4Slot.cxx:254
Bool_t DoingDelete() const
Definition: TGo4Slot.h:125
const char * GetInfo()
Definition: TGo4Slot.cxx:329
virtual ~TGo4Slot()
Definition: TGo4Slot.cxx:110
void ReadData(TDirectory *dir)
Definition: TGo4Slot.cxx:436
TGo4Slot * fParent
Definition: TGo4Slot.h:37
static void ProduceFolderAndName(const char *fullname, TString &foldername, TString &objectname)
Definition: TGo4Slot.cxx:668
void ForwardEvent(TGo4Slot *source, Int_t id, void *param=0)
Definition: TGo4Slot.cxx:585
virtual void Delete(Option_t *opt="")
Definition: TGo4Slot.cxx:190
Int_t fAssignFlag
Definition: TGo4Slot.h:41
virtual void Print(Option_t *option) const
Definition: TGo4Slot.cxx:601
Bool_t AssignObject(TObject *obj, Bool_t owner)
Definition: TGo4Slot.cxx:361
Int_t NumChilds() const
Definition: TGo4Slot.h:76
TString GetFullName(TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:290
Int_t GetSizeInfo()
Definition: TGo4Slot.cxx:338
virtual TGo4ObjectManager * GetOM() const
Definition: TGo4Slot.cxx:298
void SetPar(const char *name, const char *value)
Definition: TGo4Slot.cxx:609
TGo4Access * ProvideSlotAccess(const char *name)
Definition: TGo4Slot.cxx:413
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:356
TGo4Slot * GetNext()
Definition: TGo4Slot.cxx:274