GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4FitSlot.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 TGO4FITSLOT_H
15#define TGO4FITSLOT_H
16
17#include "TGo4FitNamed.h"
18
19class TSeqCollection;
20class TObjArray;
21
28class TGo4FitSlot : public TGo4FitNamed {
29 public:
30
35
42 TGo4FitSlot(TNamed *iOwner, TClass *iClass);
43
50 TGo4FitSlot(const char *iName, const char *iTitle,
51 TNamed *iOwner, TClass *iClass,
52 Bool_t iNeeded = kFALSE, TObject *iObject = nullptr, Bool_t iOwned = kFALSE);
53
57 virtual ~TGo4FitSlot();
58
62 TClass *GetClass() const { return fxClass; }
63
68 void SetDefaults(TNamed *iOwner, TClass *iClass);
69
76 void SetSaveFlag(Int_t iSaveFlag) { fiSaveFlag = iSaveFlag; }
77
81 Int_t GetSaveFlag() const { return fiSaveFlag; }
82
86 Bool_t IsSuitable(TObject *obj) const;
87
91 Bool_t IsSuitableClass(TClass *cl) const;
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 !fbOwned && fbConnected && fxObject ? dynamic_cast<TGo4FitSlot *>(fxObject) : nullptr; }
125
129 Bool_t IsConnectedToSlot() const { return GetConnectedSlot() != nullptr; }
130
135
139 TObject *GetObject() const;
140
144 const char *GetObjectName() const;
145
150 TObject *CloneObject(const char *newname = nullptr);
151
156 void Clear(Option_t * = "") override { SetObject(nullptr, kFALSE); }
157
161 Bool_t GetOwned() const { return fbOwned; }
162
167 void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
168
173 Bool_t GetNeeded() const { return fbNeeded; }
174
178 void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
179
183 Bool_t IsEmpty() const { return GetObject() == nullptr; }
184
188 Bool_t IsObject() const { return GetObject() != nullptr; }
189
193 Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
194
198 void Print(Option_t *option = "") const override;
199
200 protected:
201
202 friend class TGo4FitSlotList;
203
204 void SetSaveSettings(Int_t save = -1, Int_t own = -1);
205
206 Bool_t HasSaveSettings();
207
208 Bool_t WillBeSaved();
209
215 void CheckOwnership();
216
220 TClass *fxClass{nullptr};
221
225 Int_t fiSaveFlag{0};
226
227
231 Bool_t fbOwned{kFALSE};
232
236 Bool_t fbConnected{kFALSE};
237
241 Bool_t fbNeeded{kFALSE};
242
246 TObject *fxObject{nullptr};
247
248 Int_t fiSaveSlot{0};
250
251 ClassDefOverride(TGo4FitSlot,1)
252};
253
254
255//************************************************************************************************
256
258 public:
260 virtual ~TGo4FitSlotList();
261
266 virtual void FillSlotList(TSeqCollection *lst);
267
271 void SetUpdateSlotList();
272
278 const TObjArray *GetSlotList(Bool_t ForceUpdate = kFALSE);
279
283 Int_t NumSlots();
284
288 TGo4FitSlot *GetSlot(Int_t nslot);
289
293 TGo4FitSlot *FindSlot(const char *FullSlotName);
294
299 Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2);
300
305 Bool_t ConnectSlots(const char *Slot1FullName, const char *Slot2FullName);
306
312 TGo4FitSlot *SetObject(TObject *obj, Bool_t iOwned = kFALSE);
313
321 TGo4FitSlot *SetObject(const char *PlaceName, TObject *obj, Bool_t iOwned = kFALSE);
322
327 TGo4FitSlot *IsObjectInSlots(TObject *obj);
328
332 Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
333
337 Bool_t IsEmptySlots();
338
345 void ClearObjects(const char *PlaceName = nullptr, Bool_t NonOwned = kTRUE);
346
352 void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned);
353
362 void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName = nullptr);
363
364 protected:
365
370
372
373 TObjArray *fxSlotList{nullptr};
374 Bool_t fbUpdateSlotList{kFALSE};
375
376
378
379};
380
381#endif // TGO4FITSLOT_H
382
TGo4FitNamed()
Default constructor.
virtual void FillSlotList(TSeqCollection *lst)
Fill list of TGo4FitSlot objects to provided collection.
TGo4FitSlot * FindSlot(const char *FullSlotName)
Find slot in list with given full name;.
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
Clear object in specified slot.
TObjArray * fxSlotList
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
Set object to first suitable slot with defined ownership flag.
Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2)
Connects first slot to second.
void PrepareSlotsForWriting()
void CheckDuplicatesOnSlot()
Resolve situation, when same object assigned to several slots with ownership flag.
ClassDef(TGo4FitSlotList, 1)
Int_t NumSlots()
Returns number of slots in list.
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=nullptr)
Set save flag for object(s), assigned to fitter.
Bool_t IsEmptySlots()
Return kTRUE, if there are empty slots in list.
virtual ~TGo4FitSlotList()
TGo4FitSlot * GetSlot(Int_t nslot)
Returns slots from list with specified index.
void SetUpdateSlotList()
Update internal list of slots (if exists).
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Check, if all necessary objects are provided.
Bool_t fbUpdateSlotList
TGo4FitSlot * IsObjectInSlots(TObject *obj)
Checks, if object assign to one of slots.
void ClearObjects(const char *PlaceName=nullptr, Bool_t NonOwned=kTRUE)
Clear object from slot(s), which are defined by PlaceName condition.
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
Return pointer in TObjArray with list of all slots in list.
Managing pointers on specific objects.
Definition TGo4FitSlot.h:28
Bool_t fbConnected
If object is connected slot.
const char * GetObjectName() const
Return name of assigned object.
Bool_t fbOwned
0 - slot save if owned(default), 1 - saved always, 2 - saved never
Int_t GetSaveFlag() const
Returns save flag.
Definition TGo4FitSlot.h:81
void ClearConnectionToSlot()
Clear connection to other slot.
TGo4FitSlot * GetConnectedSlot() const
Returns pointer to connected slot or 0, if not connected.
TClass * GetClass() const
Return pointer on class for desired object.
Definition TGo4FitSlot.h:62
TObject * CloneObject(const char *newname=nullptr)
Clone object in slot and returns pointer on new object.
Bool_t IsEmpty() const
Return kTRUE, if no object in slot.
Bool_t fbNeeded
Flag, is this object should always be set.
void SetNeeded(Bool_t iNeeded)
Set requirement flag for object.
TClass * fxClass
Class of object, which should be assigned to slot.
Bool_t WillBeSaved()
Bool_t IsSuitableClass(TClass *cl) const
Checks, if class corresponds to specified for slot.
Bool_t IsRequired() const
Returns kTRUE, if object required, but not yet set.
void SetSaveFlag(Int_t iSaveFlag)
Set save flag for saving of object in slot, when slot stored to streamer: 0 - object will be saved if...
Definition TGo4FitSlot.h:76
TObject * fxObject
Pointer on assigned object.
Bool_t ConnectToSlot(TGo4FitSlot *slot)
Connect this slot to provided slot.
void Print(Option_t *option="") const override
Print information on standard output.
void CheckOwnership()
Sets up ownership relation between object and owner of slot.
Int_t fiSaveSlot
Bool_t GetOwned() const
Return ownership flag.
Bool_t IsSuitable(TObject *obj) const
Checks, if object class corresponds to class, specified for slot.
Bool_t GetNeeded() const
Return requirement status for slot.
virtual ~TGo4FitSlot()
Destroys TFo4FitSlot object.
Int_t fiSaveFlag
Describe saving of object in slot.
Bool_t CanConnectToSlot(TGo4FitSlot *slot)
Checks, if slot can be connected to other.
Bool_t IsObject() const
Return kTRUE, if object assigned to slot.
void SetDefaults(TNamed *iOwner, TClass *iClass)
Set basic fields of slot.
TGo4FitSlot()
Default constructor.
friend class TGo4FitSlotList
void Clear(Option_t *="") override
Clear pointer on object in slot.
void SetOwned(Bool_t iOwned=kTRUE)
Explicitly sets ownership flag.
Bool_t IsConnectedToSlot() const
Returns kTRUE, if slot connected to another slot.
Bool_t HasSaveSettings()
void SetSaveSettings(Int_t save=-1, Int_t own=-1)
Int_t fiSaveOwnership
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
Sets object to slot.
void ClearObject()
Method remove object pointer.
TObject * GetObject() const
Return pointer on assigned object.