1    	// @(#)root/cont:$Id$
2    	// Author: Rene Brun   28/09/2001
3    	
4    	/*************************************************************************
5    	 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
6    	 * All rights reserved.                                                  *
7    	 *                                                                       *
8    	 * For the licensing terms see $ROOTSYS/LICENSE.                         *
9    	 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
10   	 *************************************************************************/
11   	
12   	#ifndef ROOT_TRef
13   	#define ROOT_TRef
14   	
15   	
16   	//////////////////////////////////////////////////////////////////////////
17   	//                                                                      //
18   	// TRef                                                                 //
19   	//                                                                      //
20   	// Persistent Reference link to a TObject                               //
21   	//                                                                      //
22   	//////////////////////////////////////////////////////////////////////////
23   	
24   	
25   	#ifndef ROOT_TObject
26   	#include "TObject.h"
27   	#endif
28   	
29   	class TProcessID;
30   	class TFile;
31   	class TExec;
32   	class TObjArray;
33   	
34   	class TRef : public TObject {
35   	
36   	protected:
37   	   TProcessID       *fPID;     //!Pointer to ProcessID when TRef was written
38   	
39   	   static TObjArray  *fgExecs;  //List of execs
40   	   static TObject    *fgObject; //In: this, Out: pointer to object (used by Action on Demand)
41   	
42   	public:
43   	   //status bits
44   	   enum { kNotComputed = BIT(12)};
45   	
46   	   TRef(): fPID(0) { }
47   	   TRef(TObject *obj);
48   	   TRef(const TRef &ref);
49   	   void  operator=(TObject *obj);
50   	   TRef& operator=(const TRef &ref);
51   	   virtual ~TRef() { }
52   	
53   	   TObject           *GetObject() const;
54   	   TProcessID        *GetPID() const {return fPID;}
55   	   Bool_t             IsValid() const {return GetUniqueID()!=0 ? kTRUE : kFALSE;}
56   	   virtual void       SetAction(const char *name);
57   	   virtual void       SetAction(TObject *parent);
58   	
59   	   static void        SetObject(TObject *obj);
60   	   static void        SetStaticObject(TObject *obj);
61   	   static Int_t       AddExec(const char *name);
62   	   static TObjArray  *GetListOfExecs();
63   	   static TObject    *GetStaticObject();
64   	
65   	   friend Bool_t operator==(const TRef &r1, const TRef &r2);
66   	   friend Bool_t operator!=(const TRef &r1, const TRef &r2);
67   	
68   	   ClassDef(TRef,1)  //Persistent Reference link to a TObject
69   	};
70   	
71   	#endif
72