Logo ROOT   6.08/07
Reference Guide
TRefProxy.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Markus Frank 20/05/2005
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_TRefProxy
13 #define ROOT_TRefProxy
14 
15 #include <map>
16 #include <string>
17 
18 #ifndef ROOT_TVirtualRefProxy
19 #include "TVirtualRefProxy.h"
20 #endif
21 
22 #ifndef ROOT_TClassRef
23 #include "TClassRef.h"
24 #endif
25 
26 // Forward declarations
28 
29 //______________________________________________________________________________
30 //
31 // TRefProxy is a reference proxy, which allows to access ROOT references (TRef)
32 // stored contained in other objects from TTree::Draw
33 //______________________________________________________________________________
34 
35 class TRefProxy : public TVirtualRefProxy {
36 protected:
37  TClassRef fClass; //! Pointer to the reference class (TRef::Class())
38 
39 public:
40  /// Default constructor
41  TRefProxy() : fClass("TRef") {}
42  /// Copy constructor
43  TRefProxy(const TRefProxy& c) : TVirtualRefProxy(), fClass(c.fClass) {}
44  /// Assignement operator
45  TRefProxy &operator=(const TRefProxy& c) { fClass =c.fClass; return *this; }
46 
47  /// TVirtualRefProxy overload: Release the reference proxy (virtual destructor)
48  virtual void Release() { delete this; }
49  /// TVirtualRefProxy overload: Clone the reference proxy (virtual constructor)
50  virtual TVirtualRefProxy* Clone() const { return new TRefProxy(*this);}
51  /// TVirtualRefProxy overload: Setter of reference class (executed when the proxy is adopted)
52  virtual void SetClass(TClass *cl) { fClass = cl; }
53  /// TVirtualRefProxy overload: Getter of reference class (executed when the proxy is adopted)
54  virtual TClass * GetClass() const { return fClass; }
55  /// TVirtualRefProxy overload: Access to value class
56  virtual TClass* GetValueClass(void* data) const;
57  /// TVirtualRefProxy overload: Prepare reused reference object (e.g. ZERO data pointers)
58  virtual void* GetPreparedReference(void* data) { return data; }
59  /// TVirtualRefProxy overload: Update (and propagate) cached information
60  virtual Bool_t Update();
61  /// TVirtualRefProxy overload: Flag to indicate if this is a container reference
62  virtual Bool_t HasCounter() const { return kFALSE; }
63  /// TVirtualRefProxy overload: Access to container size (if container reference (ie TRefArray) etc)
64  virtual Int_t GetCounterValue(TFormLeafInfoReference* /* info */, void* /* data */)
65  { return 0; }
66  /// TVirtualRefProxy overload: Access referenced object(-data)
67  virtual void* GetObject(TFormLeafInfoReference* info, void* data, int instance);
68 };
69 #endif // ROOT_TRefProxy
A small helper class to implement the following of reference objects stored in a TTree.
virtual void SetClass(TClass *cl)
TVirtualRefProxy overload: Setter of reference class (executed when the proxy is adopted) ...
Definition: TRefProxy.h:52
return c
virtual TClass * GetClass() const
TVirtualRefProxy overload: Getter of reference class (executed when the proxy is adopted) ...
Definition: TRefProxy.h:54
virtual TVirtualRefProxy * Clone() const
TVirtualRefProxy overload: Clone the reference proxy (virtual constructor)
Definition: TRefProxy.h:50
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Int_t GetCounterValue(TFormLeafInfoReference *, void *)
TVirtualRefProxy overload: Access to container size (if container reference (ie TRefArray) etc) ...
Definition: TRefProxy.h:64
TRefProxy()
Pointer to the reference class (TRef::Class())
Definition: TRefProxy.h:41
virtual void * GetPreparedReference(void *data)
TVirtualRefProxy overload: Prepare reused reference object (e.g. ZERO data pointers) ...
Definition: TRefProxy.h:58
virtual TClass * GetValueClass(void *data) const
TVirtualRefProxy overload: Access to value class.
Definition: TRefProxy.cxx:39
virtual Bool_t HasCounter() const
TVirtualRefProxy overload: Flag to indicate if this is a container reference.
Definition: TRefProxy.h:62
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
TRefProxy & operator=(const TRefProxy &c)
Assignement operator.
Definition: TRefProxy.h:45
virtual Bool_t Update()
TVirtualRefProxy overload: Update (and propagate) cached information.
Definition: TRefProxy.cxx:31
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:33
TRefProxy(const TRefProxy &c)
Copy constructor.
Definition: TRefProxy.h:43
virtual void Release()
TVirtualRefProxy overload: Release the reference proxy (virtual destructor)
Definition: TRefProxy.h:48
virtual void * GetObject(TFormLeafInfoReference *info, void *data, int instance)
TVirtualRefProxy overload: Access referenced object(-data)
Definition: TRefProxy.cxx:48
TClassRef fClass
Definition: TRefProxy.h:37