GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitSlot.h
Go to the documentation of this file.
1 // $Id: TGo4FitSlot.h 2629 2019-10-01 08:20:21Z 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 TGO4FITSLOT_H
15 #define TGO4FITSLOT_H
16 
17 #include "TGo4FitNamed.h"
18 
19 class TSeqCollection;
20 class TObjArray;
21 
27 class TGo4FitSlot : public TGo4FitNamed {
28  public:
29 
33  TGo4FitSlot();
34 
41  TGo4FitSlot(TNamed* iOwner, TClass* iClass);
42 
49  TGo4FitSlot(const char* iName, const char* iTitle,
50  TNamed* iOwner, TClass* iClass,
51  Bool_t iNeeded = kFALSE, TObject* iObject = 0, Bool_t iOwned = kFALSE);
52 
56  virtual ~TGo4FitSlot();
57 
61  TClass* GetClass() { return fxClass; }
62 
67  void SetDefaults(TNamed* iOwner, TClass* iClass);
68 
75  void SetSaveFlag(Int_t iSaveFlag) { fiSaveFlag = iSaveFlag; }
76 
80  Int_t GetSaveFlag() { return fiSaveFlag; }
81 
85  Bool_t IsSuitable(TObject* obj);
86 
87 
91  Bool_t IsSuitableClass(TClass* cl);
92 
97  void ClearObject();
98 
106  Bool_t SetObject(TObject* iObject, Bool_t iOwned = kFALSE, Bool_t CheckClass = kTRUE);
107 
114  Bool_t ConnectToSlot(TGo4FitSlot* slot);
115 
119  Bool_t CanConnectToSlot(TGo4FitSlot* slot);
120 
124  TGo4FitSlot* GetConnectedSlot() const { return dynamic_cast<TGo4FitSlot*>(fxObject); }
125 
129  Bool_t IsConnectedToSlot() const { return GetConnectedSlot()!=0; }
130 
134  void ClearConnectionToSlot();
135 
139  TObject* GetObject() const;
140 
144  const char* GetObjectName() const;
145 
150  TObject* CloneObject(const char* newname = 0);
151 
156  virtual void Clear(Option_t* = "") { SetObject(0, kFALSE); }
157 
161  Bool_t GetOwned() { return fbOwned; }
162 
167  void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
168 
173  Bool_t GetNeeded() { return fbNeeded; }
174 
178  void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
179 
183  Bool_t IsEmpty() const { return GetObject()==0; }
184 
188  Bool_t IsObject() const { return GetObject()!=0; }
189 
193  Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
194 
198  virtual void Print(Option_t* option) const;
199 
200 
201  protected:
202 
203  friend class TGo4FitSlotList;
204 
205  void SetSaveSettings(Int_t save = -1, Int_t own = -1);
206 
207  Bool_t HasSaveSettings();
208 
209  Bool_t WillBeSaved();
210 
216  void CheckOwnership();
217 
221  TClass* fxClass;
222 
226  Int_t fiSaveFlag;
227 
228 
232  Bool_t fbOwned;
233 
237  Bool_t fbNeeded;
238 
242  TObject* fxObject;
243 
244  Int_t fiSaveSlot;
246 
248 };
249 
250 
251 //************************************************************************************************
252 
254  public:
255  TGo4FitSlotList();
256  virtual ~TGo4FitSlotList();
257 
262  virtual void FillSlotList(TSeqCollection* lst);
263 
267  void SetUpdateSlotList();
268 
274  const TObjArray* GetSlotList(Bool_t ForceUpdate = kFALSE);
275 
279  Int_t NumSlots();
280 
284  TGo4FitSlot* GetSlot(Int_t nslot);
285 
289  TGo4FitSlot* FindSlot(const char* FullSlotName);
290 
295  Bool_t ConnectSlots(TGo4FitSlot* slot1, TGo4FitSlot* slot2);
296 
301  Bool_t ConnectSlots(const char* Slot1FullName, const char* Slot2FullName);
302 
308  TGo4FitSlot* SetObject(TObject* obj, Bool_t iOwned = kFALSE);
309 
317  TGo4FitSlot* SetObject(const char* PlaceName, TObject* obj, Bool_t iOwned = kFALSE);
318 
323  TGo4FitSlot* IsObjectInSlots(TObject* obj);
324 
328  Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
329 
333  Bool_t IsEmptySlots();
334 
341  void ClearObjects(const char* PlaceName = 0, Bool_t NonOwned = kTRUE);
342 
348  void ClearSlot(TGo4FitSlot* slot, Bool_t NonOwned);
349 
358  void SetSaveFlagForObjects(Int_t iSaveFlag, const char* PlaceName = 0);
359 
360  protected:
361 
365  void CheckDuplicatesOnSlot();
366 
367  void PrepareSlotsForWriting();
368 
369  TObjArray* fxSlotList;
371 
372 
374 
375 };
376 
377 #endif // TGO4FITSLOT_H
378 
379 
void SetUpdateSlotList()
void SetSaveSettings(Int_t save=-1, Int_t own=-1)
Bool_t fbOwned
0 - slot save if owned(default), 1 - saved always, 2 - saved never
Definition: TGo4FitSlot.h:232
const char * GetObjectName() const
void SetNeeded(Bool_t iNeeded)
Definition: TGo4FitSlot.h:178
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
TGo4FitSlot * GetSlot(Int_t nslot)
TGo4FitSlot * IsObjectInSlots(TObject *obj)
virtual ~TGo4FitSlot()
Definition: TGo4FitSlot.cxx:62
void ClearConnectionToSlot()
Definition: TGo4FitSlot.cxx:93
Bool_t IsEmptySlots()
virtual void Clear(Option_t *="")
Definition: TGo4FitSlot.h:156
virtual ~TGo4FitSlotList()
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
Bool_t GetNeeded()
Definition: TGo4FitSlot.h:173
void SetSaveFlag(Int_t iSaveFlag)
Definition: TGo4FitSlot.h:75
Int_t fiSaveSlot
Definition: TGo4FitSlot.h:244
Bool_t HasSaveSettings()
TClass * fxClass
Definition: TGo4FitSlot.h:221
Bool_t IsEmpty() const
Definition: TGo4FitSlot.h:183
Bool_t IsConnectedToSlot() const
Definition: TGo4FitSlot.h:129
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=0)
Int_t fiSaveFlag
Definition: TGo4FitSlot.h:226
void PrepareSlotsForWriting()
Bool_t fbNeeded
Definition: TGo4FitSlot.h:237
Bool_t GetOwned()
Definition: TGo4FitSlot.h:161
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2)
Bool_t IsRequired() const
Definition: TGo4FitSlot.h:193
Bool_t IsSuitableClass(TClass *cl)
TGo4FitSlot * GetConnectedSlot() const
Definition: TGo4FitSlot.h:124
void CheckDuplicatesOnSlot()
void CheckOwnership()
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
TObject * fxObject
Definition: TGo4FitSlot.h:242
TClass * GetClass()
Definition: TGo4FitSlot.h:61
ClassDef(TGo4FitSlotList, 1)
virtual void FillSlotList(TSeqCollection *lst)
Int_t GetSaveFlag()
Definition: TGo4FitSlot.h:80
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Bool_t IsObject() const
Definition: TGo4FitSlot.h:188
Bool_t ConnectToSlot(TGo4FitSlot *slot)
Definition: TGo4FitSlot.cxx:74
TObject * CloneObject(const char *newname=0)
TObjArray * fxSlotList
Definition: TGo4FitSlot.h:369
void SetDefaults(TNamed *iOwner, TClass *iClass)
Definition: TGo4FitSlot.cxx:68
Bool_t WillBeSaved()
Bool_t fbUpdateSlotList
Definition: TGo4FitSlot.h:370
Bool_t IsSuitable(TObject *obj)
void ClearObject()
Int_t fiSaveOwnership
Definition: TGo4FitSlot.h:245
TObject * GetObject() const
TGo4FitSlot * FindSlot(const char *FullSlotName)
void SetOwned(Bool_t iOwned=kTRUE)
Definition: TGo4FitSlot.h:167
virtual void Print(Option_t *option) const
void ClearObjects(const char *PlaceName=0, Bool_t NonOwned=kTRUE)
Bool_t CanConnectToSlot(TGo4FitSlot *slot)
Definition: TGo4FitSlot.cxx:83