00001 // @(#)root/cont:$Id: TRef.h 20877 2007-11-19 11:17:07Z rdm $ 00002 // Author: Rene Brun 28/09/2001 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TRef 00013 #define ROOT_TRef 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TRef // 00019 // // 00020 // Persistent Reference link to a TObject // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 00025 #ifndef ROOT_TObject 00026 #include "TObject.h" 00027 #endif 00028 00029 class TProcessID; 00030 class TFile; 00031 class TExec; 00032 class TObjArray; 00033 00034 class TRef : public TObject { 00035 00036 protected: 00037 TProcessID *fPID; //!Pointer to ProcessID when TRef was written 00038 00039 static TObjArray *fgExecs; //List of execs 00040 static TObject *fgObject; //In: this, Out: pointer to object (used by Action on Demand) 00041 00042 public: 00043 //status bits 00044 enum { kNotComputed = BIT(12)}; 00045 00046 TRef(): fPID(0) { } 00047 TRef(TObject *obj); 00048 TRef(const TRef &ref); 00049 void operator=(TObject *obj); 00050 TRef& operator=(const TRef &ref); 00051 virtual ~TRef() { } 00052 00053 TObject *GetObject() const; 00054 TProcessID *GetPID() const {return fPID;} 00055 Bool_t IsValid() const {return GetUniqueID()!=0 ? kTRUE : kFALSE;} 00056 virtual void SetAction(const char *name); 00057 virtual void SetAction(TObject *parent); 00058 00059 static void SetObject(TObject *obj); 00060 static void SetStaticObject(TObject *obj); 00061 static Int_t AddExec(const char *name); 00062 static TObjArray *GetListOfExecs(); 00063 static TObject *GetStaticObject(); 00064 00065 friend Bool_t operator==(const TRef &r1, const TRef &r2); 00066 friend Bool_t operator!=(const TRef &r1, const TRef &r2); 00067 00068 ClassDef(TRef,1) //Persistent Reference link to a TObject 00069 }; 00070 00071 #endif