00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4FITSLOT_H
00017 #define TGO4FITSLOT_H
00018 #include "TObject.h"
00019 #include "TGo4FitNamed.h"
00020 #include "TString.h"
00021 #include "TSeqCollection.h"
00022 #include "TObjArray.h"
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
00096 Bool_t SetObject(TObject* iObject, Bool_t iOwned = kFALSE, Bool_t CheckClass = kTRUE);
00097
00104 Bool_t ConnectToSlot(TGo4FitSlot* slot);
00105
00109 Bool_t CanConnectToSlot(TGo4FitSlot* slot);
00110
00114 TGo4FitSlot* GetConnectedSlot() const { return dynamic_cast<TGo4FitSlot*>(fxObject); }
00115
00119 Bool_t IsConnectedToSlot() const { return GetConnectedSlot()!=0; }
00120
00124 void ClearConnectionToSlot();
00125
00129 TObject* GetObject() const;
00130
00134 const char* GetObjectName() const;
00135
00140 TObject* CloneObject(const char* newname = 0);
00141
00146 void Clear() { SetObject(0, kFALSE); }
00147
00151 Bool_t GetOwned() { return fbOwned; }
00152
00157 void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
00158
00163 Bool_t GetNeeded() { return fbNeeded; }
00164
00168 void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
00169
00173 Bool_t IsEmpty() const { return GetObject()==0; }
00174
00178 Bool_t IsObject() const { return GetObject()!=0; }
00179
00183 Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
00184
00188 virtual void Print(Option_t* option) const;
00189
00190
00191 protected:
00192
00193 friend class TGo4FitSlotList;
00194
00195 void SetSaveSettings(Int_t save = -1, Int_t own = -1);
00196
00197 Bool_t HasSaveSettings();
00198
00199 Bool_t WillBeSaved();
00200
00206 void CheckOwnership();
00207
00211 TClass* fxClass;
00212
00216 Int_t fiSaveFlag;
00217
00218
00222 Bool_t fbOwned;
00223
00227 Bool_t fbNeeded;
00228
00232 TObject* fxObject;
00233
00234 Int_t fiSaveSlot;
00235 Int_t fiSaveOwnership;
00236
00237 ClassDef(TGo4FitSlot,1)
00238 };
00239
00240
00241
00242
00243 class TGo4FitSlotList {
00244 public:
00245 TGo4FitSlotList();
00246 virtual ~TGo4FitSlotList();
00247
00252 virtual void FillSlotList(TSeqCollection* lst);
00253
00257 void SetUpdateSlotList();
00258
00264 const TObjArray* GetSlotList(Bool_t ForceUpdate = kFALSE);
00265
00269 Int_t NumSlots();
00270
00274 TGo4FitSlot* GetSlot(Int_t nslot);
00275
00279 TGo4FitSlot* FindSlot(const char* FullSlotName);
00280
00285 Bool_t ConnectSlots(TGo4FitSlot* slot1, TGo4FitSlot* slot2);
00286
00291 Bool_t ConnectSlots(const char* Slot1FullName, const char* Slot2FullName);
00292
00298 TGo4FitSlot* SetObject(TObject* obj, Bool_t iOwned = kFALSE);
00299
00307 TGo4FitSlot* SetObject(const char* PlaceName, TObject* obj, Bool_t iOwned = kFALSE);
00308
00313 TGo4FitSlot* IsObjectInSlots(TObject* obj);
00314
00318 Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
00319
00323 Bool_t IsEmptySlots();
00324
00331 void ClearObjects(const char* PlaceName = 0, Bool_t NonOwned = kTRUE);
00332
00338 void ClearSlot(TGo4FitSlot* slot, Bool_t NonOwned);
00339
00348 void SetSaveFlagForObjects(Int_t iSaveFlag, const char* PlaceName = 0);
00349
00350 protected:
00351
00355 void CheckDuplicatesOnSlot();
00356
00357 void PrepareSlotsForWriting();
00358
00359 TObjArray* fxSlotList;
00360 Bool_t fbUpdateSlotList;
00361
00362
00363 ClassDef(TGo4FitSlotList,1);
00364
00365 };
00366
00367 #endif // TGO4FITSLOT_H
00368
00369
00370
00371