Logo ROOT  
Reference Guide
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
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObjArray
Definition: TObjArray.h:37
TRef::AddExec
static Int_t AddExec(const char *name)
If Exec with name does not exist in the list of Execs, it is created.
Definition: TRef.cxx:339
TRef::operator=
void operator=(TObject *obj)
Assign object to reference.
Definition: TRef.cxx:278
TRef::GetListOfExecs
static TObjArray * GetListOfExecs()
Return a pointer to the static TObjArray holding the list of Execs.
Definition: TRef.cxx:359
TRef::operator==
friend Bool_t operator==(const TRef &r1, const TRef &r2)
Return kTRUE if r1 and r2 point to the same object.
Definition: TRef.cxx:320
TRef::GetObject
TObject * GetObject() const
Return a pointer to the referenced object.
Definition: TRef.cxx:377
TProcessID
Definition: TProcessID.h:74
Int_t
int Int_t
Definition: RtypesCore.h:45
TObject::GetUniqueID
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:377
TRef::IsValid
Bool_t IsValid() const
Definition: TRef.h:51
TRef::GetPID
TProcessID * GetPID() const
Definition: TRef.h:50
TRef::operator!=
friend Bool_t operator!=(const TRef &r1, const TRef &r2)
Return kTRUE if r1 and r2 do not point to the same object.
Definition: TRef.cxx:329
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
bool
TExec
Definition: TExec.h:28
TRef::SetAction
virtual void SetAction(const char *name)
Store the exec number (in the ROOT list of Execs) into the fBits of this TRef.
Definition: TRef.cxx:429
TRef::TRef
TRef()
Definition: TRef.h:42
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TRef::SetStaticObject
static void SetStaticObject(TObject *obj)
Static function to set the object found on the Action on Demand function.
Definition: TRef.cxx:478
TFile
Definition: TFile.h:54
TObject.h
TRef::fPID
TProcessID * fPID
Definition: TRef.h:35
TRef::~TRef
virtual ~TRef()
Definition: TRef.h:47
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
TRef
Definition: TRef.h:32
TRef::fgObject
static TObject * fgObject
Definition: TRef.h:38
TRef::SetObject
static void SetObject(TObject *obj)
static Obsolete function kept for back compatibility.
Definition: TRef.cxx:466
TRef::GetStaticObject
static TObject * GetStaticObject()
Returns the static object.
Definition: TRef.cxx:458
TRef::fgExecs
static TObjArray * fgExecs
Pointer to ProcessID when TRef was written.
Definition: TRef.h:37