ROOT logo
// @(#)root/cont:$Id: TRef.h 20877 2007-11-19 11:17:07Z rdm $
// Author: Rene Brun   28/09/2001

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TRef
#define ROOT_TRef


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRef                                                                 //
//                                                                      //
// Persistent Reference link to a TObject                               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


#ifndef ROOT_TObject
#include "TObject.h"
#endif

class TProcessID;
class TFile;
class TExec;
class TObjArray;

class TRef : public TObject {

protected:
   TProcessID       *fPID;     //!Pointer to ProcessID when TRef was written

   static TObjArray  *fgExecs;  //List of execs
   static TObject    *fgObject; //In: this, Out: pointer to object (used by Action on Demand)

public:
   //status bits
   enum { kNotComputed = BIT(12)};

   TRef(): fPID(0) { }
   TRef(TObject *obj);
   TRef(const TRef &ref);
   void  operator=(TObject *obj);
   TRef& operator=(const TRef &ref);
   virtual ~TRef() { }

   TObject           *GetObject() const;
   TProcessID        *GetPID() const {return fPID;}
   Bool_t             IsValid() const {return GetUniqueID()!=0 ? kTRUE : kFALSE;}
   virtual void       SetAction(const char *name);
   virtual void       SetAction(TObject *parent);

   static void        SetObject(TObject *obj);
   static void        SetStaticObject(TObject *obj);
   static Int_t       AddExec(const char *name);
   static TObjArray  *GetListOfExecs();
   static TObject    *GetStaticObject();

   friend Bool_t operator==(const TRef &r1, const TRef &r2);
   friend Bool_t operator!=(const TRef &r1, const TRef &r2);

   ClassDef(TRef,1)  //Persistent Reference link to a TObject
};

#endif
 TRef.h:1
 TRef.h:2
 TRef.h:3
 TRef.h:4
 TRef.h:5
 TRef.h:6
 TRef.h:7
 TRef.h:8
 TRef.h:9
 TRef.h:10
 TRef.h:11
 TRef.h:12
 TRef.h:13
 TRef.h:14
 TRef.h:15
 TRef.h:16
 TRef.h:17
 TRef.h:18
 TRef.h:19
 TRef.h:20
 TRef.h:21
 TRef.h:22
 TRef.h:23
 TRef.h:24
 TRef.h:25
 TRef.h:26
 TRef.h:27
 TRef.h:28
 TRef.h:29
 TRef.h:30
 TRef.h:31
 TRef.h:32
 TRef.h:33
 TRef.h:34
 TRef.h:35
 TRef.h:36
 TRef.h:37
 TRef.h:38
 TRef.h:39
 TRef.h:40
 TRef.h:41
 TRef.h:42
 TRef.h:43
 TRef.h:44
 TRef.h:45
 TRef.h:46
 TRef.h:47
 TRef.h:48
 TRef.h:49
 TRef.h:50
 TRef.h:51
 TRef.h:52
 TRef.h:53
 TRef.h:54
 TRef.h:55
 TRef.h:56
 TRef.h:57
 TRef.h:58
 TRef.h:59
 TRef.h:60
 TRef.h:61
 TRef.h:62
 TRef.h:63
 TRef.h:64
 TRef.h:65
 TRef.h:66
 TRef.h:67
 TRef.h:68
 TRef.h:69
 TRef.h:70
 TRef.h:71