00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4SLOT_H
00017 #define TGO4SLOT_H
00018
00019 #include "TNamed.h"
00020 #include "TObjArray.h"
00021 #include "TGo4Proxy.h"
00022
00023 class TClass;
00024 class TDirectory;
00025 class TGo4ObjectManager;
00026
00027 class TGo4Slot : public TNamed {
00028 protected:
00029
00030 enum ESlotBits {
00031 kStartDelete = BIT(23)
00032 };
00033
00034 void CleanProxy();
00035
00036 void AddChild(TGo4Slot* child);
00037 void RemoveChild(TGo4Slot* child);
00038
00039 TGo4Slot* fParent;
00040 TObjArray* fChilds;
00041 TObjArray fPars;
00042 TGo4Proxy* fProxy;
00043 Int_t fAssignFlag;
00044
00045 public:
00046 enum { evDelete = 0,
00047 evCreate = 1,
00048 evObjAssigned = 2,
00049 evContAssigned = 3,
00050 evObjUpdated = 4,
00051 evSubslotUpdated = 5,
00052 evObjDeleted = 6 };
00053
00054 TGo4Slot();
00055 TGo4Slot(TGo4Slot* parent);
00056 TGo4Slot(TGo4Slot* parent, const char* name, const char* title);
00057 virtual ~TGo4Slot();
00058
00059 TGo4Slot* GetParent() const { return fParent; }
00060 void SetParent(TGo4Slot* parent) { fParent = parent; }
00061 Bool_t IsParent(const TGo4Slot* slot) const;
00062
00063 virtual void ProduceFullName(TString& name, TGo4Slot* toparent = 0);
00064 TString GetFullName(TGo4Slot* toparent = 0);
00065 virtual TGo4ObjectManager* GetOM() const;
00066
00067 const char* GetInfo();
00068 Int_t GetSizeInfo();
00069
00070 void SetPar(const char* name, const char* value);
00071 const char* GetPar(const char* name) const;
00072 void RemovePar(const char* name);
00073 void SetIntPar(const char* name, Int_t value);
00074 Bool_t GetIntPar(const char* name, Int_t& value);
00075 void PrintPars(Int_t level = 3);
00076
00077 Int_t NumChilds() const { return (fChilds!=0) ? fChilds->GetLast()+1 : 0; }
00078 TGo4Slot* GetChild(Int_t n) const { return (fChilds!=0) ? (TGo4Slot*) fChilds->At(n) : 0; }
00079 TGo4Slot* FindChild(const char* name);
00080 TGo4Slot* GetNextChild(TGo4Slot* child);
00081 TGo4Slot* GetNext();
00082 void DeleteChild(const char* name);
00083 void DeleteChilds(const char* startedwith = 0);
00084 virtual void Delete(Option_t *opt = "");
00085
00086 TGo4Slot* DefineSubSlot(const char* name, const char* &subname) const;
00087 TGo4Slot* GetSlot(const char* name, Bool_t force = kFALSE);
00088 TGo4Slot* FindSlot(const char* fullpath, const char** subname = 0);
00089 Bool_t ShiftSlotBefore(TGo4Slot* slot, TGo4Slot* before);
00090 Bool_t ShiftSlotAfter(TGo4Slot* slot, TGo4Slot* after);
00091
00092 void SetProxy(TGo4Proxy* cont);
00093 TGo4Proxy* GetProxy() const { return fProxy; }
00094
00095 Int_t GetSlotKind() const;
00096 const char* GetSlotClassName() const;
00097
00098 Bool_t IsAcceptObject(TClass* cl);
00099 Bool_t AssignObject(TObject* obj, Bool_t owner);
00100 TObject* GetAssignedObject();
00101 virtual void Update(Bool_t strong = kFALSE);
00102 Int_t GetAssignFlag() const { return fAssignFlag; }
00103 void ResetAssignFlag() { fAssignFlag = -1; }
00104
00105 Bool_t HasSubLevels() const;
00106 Bool_t HasSlotsSubLevels() const;
00107 TGo4LevelIter* MakeLevelIter() const;
00108 TGo4Access* ProvideSlotAccess(const char* name);
00109
00110 void SaveData(TDirectory* dir, Bool_t onlyobjs = kFALSE);
00111 void ReadData(TDirectory* dir);
00112
00113
00114 virtual void Event(TGo4Slot* source, Int_t id, void* param = 0);
00115 void ForwardEvent(TGo4Slot* source, Int_t id, void* param = 0);
00116
00117 virtual void RecursiveRemove(TObject* obj);
00118
00119 virtual void Print(Option_t* option) const;
00120
00121 static const char* FindFolderSeparator(const char* name);
00122 static void ProduceFolderAndName(const char* fullname, TString& foldername, TString& objectname);
00123
00124 Bool_t DoingDelete() const { return TestBit(kStartDelete); }
00125
00126 ClassDef(TGo4Slot, 1);
00127 };
00128
00129
00130 #endif
00131
00132
00133