GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4Slot.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 TGO4SLOT_H
15#define TGO4SLOT_H
16
17#include "TNamed.h"
18#include "TObjArray.h"
19#include "TGo4Proxy.h"
20
21class TClass;
22class TDirectory;
24
25class 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
37 TGo4Slot *fParent{nullptr};
38 TObjArray *fChilds{nullptr};
39 TObjArray fPars;
40 TGo4Proxy *fProxy{nullptr};
41 Int_t fAssignFlag{-1};
42 Int_t fAssignCnt{0};
43
44 public:
45 enum { evDelete = 0,
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 = nullptr);
63 TString GetFullName(TGo4Slot *toparent = nullptr);
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) const;
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) : nullptr; }
78 TGo4Slot *FindChild(const char *name) const;
79 Int_t GetIndexOf(const TGo4Slot *child) const;
80 TGo4Slot *GetNextChild(const TGo4Slot *child) const;
81 TGo4Slot *GetNext() const;
82 void DeleteChild(const char *name);
83 void DeleteChilds(const char *startedwith = nullptr);
84 void Delete(Option_t *opt = "") override;
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 = nullptr);
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) const;
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; }
104 Int_t GetAssignCnt() const { return fAssignCnt; }
105
106 Bool_t HasSubLevels() const;
107 Bool_t HasSlotsSubLevels() const;
109 std::unique_ptr<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 = nullptr);
116 void ForwardEvent(TGo4Slot *source, Int_t id, void *param = nullptr);
117
118 void RecursiveRemove(TObject *obj) override;
119
120 void Print(Option_t *opt = "") const override;
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
128};
129
130#endif
131
TGo4Slot * GetParent() const
Definition TGo4Slot.h:58
TGo4Slot * DefineSubSlot(const char *name, const char *&subname) const
Definition TGo4Slot.cxx:431
TString GetFullName(TGo4Slot *toparent=nullptr)
Definition TGo4Slot.cxx:274
virtual TGo4ObjectManager * GetOM() const
Definition TGo4Slot.cxx:282
virtual void Update(Bool_t strong=kFALSE)
Definition TGo4Slot.cxx:361
Bool_t GetIntPar(const char *name, Int_t &value) const
Definition TGo4Slot.cxx:624
TGo4Slot * FindSlot(const char *fullpath, const char **subname=nullptr)
Definition TGo4Slot.cxx:469
Bool_t IsParent(const TGo4Slot *slot) const
Definition TGo4Slot.cxx:178
const char * GetSlotClassName() const
Definition TGo4Slot.cxx:334
Int_t fAssignCnt
! counts number of object assignment
Definition TGo4Slot.h:42
TGo4Proxy * GetProxy() const
Definition TGo4Slot.h:93
void RemoveChild(TGo4Slot *child)
Definition TGo4Slot.cxx:544
Int_t fAssignFlag
! use in object manager to poll until object is assigned
Definition TGo4Slot.h:41
void AddChild(TGo4Slot *child)
Definition TGo4Slot.cxx:537
Bool_t DoingDelete() const
Definition TGo4Slot.h:125
ClassDefOverride(TGo4Slot, 1)
Int_t GetSlotKind() const
Definition TGo4Slot.cxx:329
void SetProxy(TGo4Proxy *cont)
Definition TGo4Slot.cxx:296
TObjArray * fChilds
Definition TGo4Slot.h:38
TGo4Slot * GetSlot(const char *name, Bool_t force=kFALSE)
Definition TGo4Slot.cxx:451
TGo4Proxy * fProxy
!
Definition TGo4Slot.h:40
void ResetAssignFlag()
Definition TGo4Slot.h:103
@ evObjUpdated
Definition TGo4Slot.h:49
@ evObjAssigned
Definition TGo4Slot.h:47
@ evSubslotUpdated
Definition TGo4Slot.h:50
@ evObjDeleted
Definition TGo4Slot.h:51
@ evContAssigned
Definition TGo4Slot.h:48
@ evDelete
Definition TGo4Slot.h:45
@ evCreate
Definition TGo4Slot.h:46
virtual ~TGo4Slot()
Definition TGo4Slot.cxx:91
Int_t NumChilds() const
Definition TGo4Slot.h:76
void SaveData(TDirectory *dir, Bool_t onlyobjs=kFALSE)
Definition TGo4Slot.cxx:410
TGo4Slot * FindChild(const char *name) const
Definition TGo4Slot.cxx:245
Int_t GetSizeInfo()
Definition TGo4Slot.cxx:321
TGo4Slot * GetNextChild(const TGo4Slot *child) const
Definition TGo4Slot.cxx:236
@ kStartDelete
Definition TGo4Slot.h:29
void ForwardEvent(TGo4Slot *source, Int_t id, void *param=nullptr)
Definition TGo4Slot.cxx:565
void RecursiveRemove(TObject *obj) override
Definition TGo4Slot.cxx:571
void CleanProxy()
Definition TGo4Slot.cxx:287
std::unique_ptr< TGo4Access > ProvideSlotAccess(const char *name)
Definition TGo4Slot.cxx:395
static void ProduceFolderAndName(const char *fullname, TString &foldername, TString &objectname)
Definition TGo4Slot.cxx:646
static const char * FindFolderSeparator(const char *name)
Definition TGo4Slot.cxx:641
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=nullptr)
Definition TGo4Slot.cxx:264
Bool_t AssignObject(TObject *obj, Bool_t owner)
Definition TGo4Slot.cxx:344
Bool_t ShiftSlotBefore(TGo4Slot *slot, TGo4Slot *before)
Definition TGo4Slot.cxx:505
void DeleteChilds(const char *startedwith=nullptr)
Definition TGo4Slot.cxx:202
TGo4Slot * fParent
Definition TGo4Slot.h:37
void SetPar(const char *name, const char *value)
Definition TGo4Slot.cxx:586
void RemovePar(const char *name)
Definition TGo4Slot.cxx:606
void SetIntPar(const char *name, Int_t value)
Definition TGo4Slot.cxx:617
const char * GetInfo()
Definition TGo4Slot.cxx:312
TObject * GetAssignedObject()
Definition TGo4Slot.cxx:356
const char * GetPar(const char *name) const
Definition TGo4Slot.cxx:598
Int_t GetAssignCnt() const
Definition TGo4Slot.h:104
TGo4LevelIter * MakeLevelIter() const
Definition TGo4Slot.cxx:382
void PrintPars(Int_t level=3)
Definition TGo4Slot.cxx:632
Bool_t HasSlotsSubLevels() const
Definition TGo4Slot.cxx:377
void ReadData(TDirectory *dir)
Definition TGo4Slot.cxx:416
Bool_t ShiftSlotAfter(TGo4Slot *slot, TGo4Slot *after)
Definition TGo4Slot.cxx:521
void SetParent(TGo4Slot *parent)
Definition TGo4Slot.h:59
void Delete(Option_t *opt="") override
Definition TGo4Slot.cxx:171
TGo4Slot * GetChild(Int_t n) const
Definition TGo4Slot.h:77
virtual void Event(TGo4Slot *source, Int_t id, void *param=nullptr)
Definition TGo4Slot.cxx:555
void DeleteChild(const char *name)
Definition TGo4Slot.cxx:188
Bool_t HasSubLevels() const
Definition TGo4Slot.cxx:370
TObjArray fPars
Definition TGo4Slot.h:39
Bool_t IsAcceptObject(TClass *cl) const
Definition TGo4Slot.cxx:339
Int_t GetAssignFlag() const
Definition TGo4Slot.h:102
TGo4Slot * GetNext() const
Definition TGo4Slot.cxx:258
void Print(Option_t *opt="") const override
Definition TGo4Slot.cxx:578
Int_t GetIndexOf(const TGo4Slot *child) const
Definition TGo4Slot.cxx:226