TGo4FitSlot.h

Go to the documentation of this file.
00001 // $Id: TGo4FitSlot.h 578 2010-02-17 09:35:37Z linev $
00002 //-----------------------------------------------------------------------
00003 //       The GSI Online Offline Object Oriented (Go4) Project
00004 //         Experiment Data Processing at EE department, GSI
00005 //-----------------------------------------------------------------------
00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
00007 //                     Planckstr. 1, 64291 Darmstadt, Germany
00008 // Contact:            http://go4.gsi.de
00009 //-----------------------------------------------------------------------
00010 // This software can be used under the license agreements as stated
00011 // in Go4License.txt file which is part of the distribution.
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 
00100       Bool_t SetObject(TObject* iObject, Bool_t iOwned = kFALSE, Bool_t CheckClass = kTRUE);
00101 
00108       Bool_t ConnectToSlot(TGo4FitSlot* slot);
00109 
00113       Bool_t CanConnectToSlot(TGo4FitSlot* slot);
00114 
00118       TGo4FitSlot* GetConnectedSlot() const { return dynamic_cast<TGo4FitSlot*>(fxObject); }
00119 
00123       Bool_t IsConnectedToSlot() const { return GetConnectedSlot()!=0; }
00124 
00128       void ClearConnectionToSlot();
00129 
00133       TObject* GetObject() const;
00134 
00138       const char* GetObjectName() const;
00139 
00144       TObject* CloneObject(const char* newname = 0);
00145 
00150       virtual void Clear(Option_t* = "") { SetObject(0, kFALSE); }
00151 
00155       Bool_t GetOwned() { return fbOwned; }
00156 
00161       void SetOwned(Bool_t iOwned = kTRUE) { fbOwned = iOwned; }
00162 
00167       Bool_t GetNeeded() { return fbNeeded; }
00168 
00172       void SetNeeded(Bool_t iNeeded) { fbNeeded = iNeeded; }
00173 
00177       Bool_t IsEmpty() const { return GetObject()==0; }
00178 
00182       Bool_t IsObject() const { return GetObject()!=0; }
00183 
00187       Bool_t IsRequired() const { return fbNeeded && IsEmpty(); }
00188 
00192       virtual void Print(Option_t* option) const;
00193 
00194 
00195    protected:
00196 
00197       friend class TGo4FitSlotList;
00198 
00199       void SetSaveSettings(Int_t save = -1, Int_t own = -1);
00200 
00201       Bool_t HasSaveSettings();
00202 
00203       Bool_t WillBeSaved();
00204 
00210       void CheckOwnership();
00211 
00215       TClass* fxClass;        
00216 
00220       Int_t fiSaveFlag;       
00221 
00222 
00226       Bool_t fbOwned;         
00227 
00231       Bool_t fbNeeded;         
00232 
00236       TObject* fxObject;       
00237 
00238       Int_t fiSaveSlot;        
00239       Int_t fiSaveOwnership;   
00240 
00241    ClassDef(TGo4FitSlot,1)
00242 };
00243 
00244 
00245 //************************************************************************************************
00246 
00247 class TGo4FitSlotList {
00248    public:
00249      TGo4FitSlotList();
00250      virtual ~TGo4FitSlotList();
00251 
00256      virtual void FillSlotList(TSeqCollection* lst);
00257 
00261      void SetUpdateSlotList();
00262 
00268      const TObjArray* GetSlotList(Bool_t ForceUpdate = kFALSE);
00269 
00273      Int_t NumSlots();
00274 
00278      TGo4FitSlot* GetSlot(Int_t nslot);
00279 
00283      TGo4FitSlot* FindSlot(const char* FullSlotName);
00284 
00289      Bool_t ConnectSlots(TGo4FitSlot* slot1, TGo4FitSlot* slot2);
00290 
00295      Bool_t ConnectSlots(const char* Slot1FullName, const char* Slot2FullName);
00296 
00302      TGo4FitSlot* SetObject(TObject* obj, Bool_t iOwned = kFALSE);
00303 
00311      TGo4FitSlot* SetObject(const char* PlaceName, TObject* obj, Bool_t iOwned = kFALSE);
00312 
00317      TGo4FitSlot* IsObjectInSlots(TObject* obj);
00318 
00322      Bool_t CheckObjects(Bool_t MakeOut = kTRUE);
00323 
00327      Bool_t IsEmptySlots();
00328 
00335      void ClearObjects(const char* PlaceName = 0, Bool_t NonOwned = kTRUE);
00336 
00342      void ClearSlot(TGo4FitSlot* slot, Bool_t NonOwned);
00343 
00352      void SetSaveFlagForObjects(Int_t iSaveFlag, const char* PlaceName = 0);
00353 
00354    protected:
00355 
00359      void CheckDuplicatesOnSlot();
00360 
00361      void PrepareSlotsForWriting();
00362 
00363      TObjArray* fxSlotList;     
00364      Bool_t fbUpdateSlotList;   
00365 
00366 
00367    ClassDef(TGo4FitSlotList,1);
00368 
00369 };
00370 
00371 #endif // TGO4FITSLOT_H
00372 
00373 

Generated on Thu Oct 28 15:54:12 2010 for Go4-Fitpackagev4.04-2 by  doxygen 1.5.1