00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4FITSLOT_H
00017 #define TGO4FITSLOT_H
00018
00019 #include "TGo4FitNamed.h"
00020
00021 class TSeqCollection;
00022 class TObjArray;
00023
00029 class TGo4FitSlot : public TGo4FitNamed {
00030 public:
00031
00035 TGo4FitSlot();
00036
00043 TGo4FitSlot(TNamed* iOwner, TClass* iClass);
00044
00051 TGo4FitSlot(const char* iName, const char* iTitle,
00052 TNamed* iOwner, TClass* iClass,
00053 Bool_t iNeeded = kFALSE, TObject* iObject = 0, Bool_t iOwned = kFALSE);
00054
00058 virtual ~TGo4FitSlot();
00059
00063 TClass* GetClass() { return fxClass; }
00064
00069 void SetDefaults(TNamed* iOwner, TClass* iClass);
00070
00077 void SetSaveFlag(Int_t iSaveFlag) { fiSaveFlag = iSaveFlag; }
00078
00082 Int_t GetSaveFlag() { return fiSaveFlag; }
00083
00087 Bool_t IsSuitable(TObject* obj);
00088
00089
00093 Bool_t IsSuitableClass(TClass* cl);
00094
00102 Bool_t SetObject(TObject* iObject, Bool_t iOwned = kFALSE, Bool_t CheckClass = kTRUE);
00103
00110 Bool_t ConnectToSlot(TGo4FitSlot* slot);
00111
00115 Bool_t CanConnectToSlot(TGo4FitSlot* slot);
00116
00120 TGo4FitSlot* GetConnectedSlot() const { return dynamic_cast<TGo4FitSlot*>(fxObject); }
00121
00125 Bool_t IsConnectedToSlot() const { return GetConnectedSlot()!=0; }
00126
00130 void ClearConnectionToSlot();
00131
00135 TObject* GetObject() const;
00136
00140 const char* GetObjectName() const;
00141
00146 TObject* CloneObject(const char* newname = 0);
00147
00152 virtual void Clear(Option_t* = "") { SetObject(0, kFALSE); }
00153
00157 Bool_t GetOwned() { return fbOwned; }
00158
00163 void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
00164
00169 Bool_t GetNeeded() { return fbNeeded; }
00170
00174 void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
00175
00179 Bool_t IsEmpty() const { return GetObject()==0; }
00180
00184 Bool_t IsObject() const { return GetObject()!=0; }
00185
00189 Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
00190
00194 virtual void Print(Option_t* option) const;
00195
00196
00197 protected:
00198
00199 friend class TGo4FitSlotList;
00200
00201 void SetSaveSettings(Int_t save = -1, Int_t own = -1);
00202
00203 Bool_t HasSaveSettings();
00204
00205 Bool_t WillBeSaved();
00206
00212 void CheckOwnership();
00213
00217 TClass* fxClass;
00218
00222 Int_t fiSaveFlag;
00223
00224
00228 Bool_t fbOwned;
00229
00233 Bool_t fbNeeded;
00234
00238 TObject* fxObject;
00239
00240 Int_t fiSaveSlot;
00241 Int_t fiSaveOwnership;
00242
00243 ClassDef(TGo4FitSlot,1)
00244 };
00245
00246
00247
00248
00249 class TGo4FitSlotList {
00250 public:
00251 TGo4FitSlotList();
00252 virtual ~TGo4FitSlotList();
00253
00258 virtual void FillSlotList(TSeqCollection* lst);
00259
00263 void SetUpdateSlotList();
00264
00270 const TObjArray* GetSlotList(Bool_t ForceUpdate = kFALSE);
00271
00275 Int_t NumSlots();
00276
00280 TGo4FitSlot* GetSlot(Int_t nslot);
00281
00285 TGo4FitSlot* FindSlot(const char* FullSlotName);
00286
00291 Bool_t ConnectSlots(TGo4FitSlot* slot1, TGo4FitSlot* slot2);
00292
00297 Bool_t ConnectSlots(const char* Slot1FullName, const char* Slot2FullName);
00298
00304 TGo4FitSlot* SetObject(TObject* obj, Bool_t iOwned = kFALSE);
00305
00313 TGo4FitSlot* SetObject(const char* PlaceName, TObject* obj, Bool_t iOwned = kFALSE);
00314
00319 TGo4FitSlot* IsObjectInSlots(TObject* obj);
00320
00324 Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
00325
00329 Bool_t IsEmptySlots();
00330
00337 void ClearObjects(const char* PlaceName = 0, Bool_t NonOwned = kTRUE);
00338
00344 void ClearSlot(TGo4FitSlot* slot, Bool_t NonOwned);
00345
00354 void SetSaveFlagForObjects(Int_t iSaveFlag, const char* PlaceName = 0);
00355
00356 protected:
00357
00361 void CheckDuplicatesOnSlot();
00362
00363 void PrepareSlotsForWriting();
00364
00365 TObjArray* fxSlotList;
00366 Bool_t fbUpdateSlotList;
00367
00368
00369 ClassDef(TGo4FitSlotList,1);
00370
00371 };
00372
00373 #endif // TGO4FITSLOT_H
00374
00375
00376
00377