Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4FITSLOT_H
00015 #define TGO4FITSLOT_H
00016
00017 #include "TGo4FitNamed.h"
00018
00019 class TSeqCollection;
00020 class TObjArray;
00021
00027 class TGo4FitSlot : public TGo4FitNamed {
00028 public:
00029
00033 TGo4FitSlot();
00034
00041 TGo4FitSlot(TNamed* iOwner, TClass* iClass);
00042
00049 TGo4FitSlot(const char* iName, const char* iTitle,
00050 TNamed* iOwner, TClass* iClass,
00051 Bool_t iNeeded = kFALSE, TObject* iObject = 0, Bool_t iOwned = kFALSE);
00052
00056 virtual ~TGo4FitSlot();
00057
00061 TClass* GetClass() { return fxClass; }
00062
00067 void SetDefaults(TNamed* iOwner, TClass* iClass);
00068
00075 void SetSaveFlag(Int_t iSaveFlag) { fiSaveFlag = iSaveFlag; }
00076
00080 Int_t GetSaveFlag() { return fiSaveFlag; }
00081
00085 Bool_t IsSuitable(TObject* obj);
00086
00087
00091 Bool_t IsSuitableClass(TClass* cl);
00092
00097 void ClearObject();
00098
00106 Bool_t SetObject(TObject* iObject, Bool_t iOwned = kFALSE, Bool_t CheckClass = kTRUE);
00107
00114 Bool_t ConnectToSlot(TGo4FitSlot* slot);
00115
00119 Bool_t CanConnectToSlot(TGo4FitSlot* slot);
00120
00124 TGo4FitSlot* GetConnectedSlot() const { return dynamic_cast<TGo4FitSlot*>(fxObject); }
00125
00129 Bool_t IsConnectedToSlot() const { return GetConnectedSlot()!=0; }
00130
00134 void ClearConnectionToSlot();
00135
00139 TObject* GetObject() const;
00140
00144 const char* GetObjectName() const;
00145
00150 TObject* CloneObject(const char* newname = 0);
00151
00156 virtual void Clear(Option_t* = "") { SetObject(0, kFALSE); }
00157
00161 Bool_t GetOwned() { return fbOwned; }
00162
00167 void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
00168
00173 Bool_t GetNeeded() { return fbNeeded; }
00174
00178 void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
00179
00183 Bool_t IsEmpty() const { return GetObject()==0; }
00184
00188 Bool_t IsObject() const { return GetObject()!=0; }
00189
00193 Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
00194
00198 virtual void Print(Option_t* option) const;
00199
00200
00201 protected:
00202
00203 friend class TGo4FitSlotList;
00204
00205 void SetSaveSettings(Int_t save = -1, Int_t own = -1);
00206
00207 Bool_t HasSaveSettings();
00208
00209 Bool_t WillBeSaved();
00210
00216 void CheckOwnership();
00217
00221 TClass* fxClass;
00222
00226 Int_t fiSaveFlag;
00227
00228
00232 Bool_t fbOwned;
00233
00237 Bool_t fbNeeded;
00238
00242 TObject* fxObject;
00243
00244 Int_t fiSaveSlot;
00245 Int_t fiSaveOwnership;
00246
00247 ClassDef(TGo4FitSlot,1)
00248 };
00249
00250
00251
00252
00253 class TGo4FitSlotList {
00254 public:
00255 TGo4FitSlotList();
00256 virtual ~TGo4FitSlotList();
00257
00262 virtual void FillSlotList(TSeqCollection* lst);
00263
00267 void SetUpdateSlotList();
00268
00274 const TObjArray* GetSlotList(Bool_t ForceUpdate = kFALSE);
00275
00279 Int_t NumSlots();
00280
00284 TGo4FitSlot* GetSlot(Int_t nslot);
00285
00289 TGo4FitSlot* FindSlot(const char* FullSlotName);
00290
00295 Bool_t ConnectSlots(TGo4FitSlot* slot1, TGo4FitSlot* slot2);
00296
00301 Bool_t ConnectSlots(const char* Slot1FullName, const char* Slot2FullName);
00302
00308 TGo4FitSlot* SetObject(TObject* obj, Bool_t iOwned = kFALSE);
00309
00317 TGo4FitSlot* SetObject(const char* PlaceName, TObject* obj, Bool_t iOwned = kFALSE);
00318
00323 TGo4FitSlot* IsObjectInSlots(TObject* obj);
00324
00328 Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
00329
00333 Bool_t IsEmptySlots();
00334
00341 void ClearObjects(const char* PlaceName = 0, Bool_t NonOwned = kTRUE);
00342
00348 void ClearSlot(TGo4FitSlot* slot, Bool_t NonOwned);
00349
00358 void SetSaveFlagForObjects(Int_t iSaveFlag, const char* PlaceName = 0);
00359
00360 protected:
00361
00365 void CheckDuplicatesOnSlot();
00366
00367 void PrepareSlotsForWriting();
00368
00369 TObjArray* fxSlotList;
00370 Bool_t fbUpdateSlotList;
00371
00372
00373 ClassDef(TGo4FitSlotList,1);
00374
00375 };
00376
00377 #endif // TGO4FITSLOT_H
00378
00379