Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TRef.h
Go to the documentation of this file.
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 #include "TObject.h"
26 
27 class TProcessID;
28 class TFile;
29 class TExec;
30 class TObjArray;
31 
32 class TRef : public TObject {
33 
34 protected:
35  TProcessID *fPID; //!Pointer to ProcessID when TRef was written
36 
37  static TObjArray *fgExecs; //List of execs
38  static TObject *fgObject; //In: this, Out: pointer to object (used by Action on Demand)
39 
40 public:
41 
42  TRef(): fPID(0) { }
43  TRef(TObject *obj);
44  TRef(const TRef &ref);
45  void operator=(TObject *obj);
46  TRef& operator=(const TRef &ref);
47  virtual ~TRef() { }
48 
49  TObject *GetObject() const;
50  TProcessID *GetPID() const {return fPID;}
51  Bool_t IsValid() const {return GetUniqueID()!=0 ? kTRUE : kFALSE;}
52  virtual void SetAction(const char *name);
53  virtual void SetAction(TObject *parent);
54 
55  static void SetObject(TObject *obj);
56  static void SetStaticObject(TObject *obj);
57  static Int_t AddExec(const char *name);
58  static TObjArray *GetListOfExecs();
59  static TObject *GetStaticObject();
60 
61  friend Bool_t operator==(const TRef &r1, const TRef &r2);
62  friend Bool_t operator!=(const TRef &r1, const TRef &r2);
63 
64  ClassDef(TRef,1) //Persistent Reference link to a TObject
65 };
66 
67 #endif