Logo ROOT   6.10/09
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 #include "TVirtualRefProxy.h"
19 
20 #include "TClassRef.h"
21 
22 // Forward declarations
24 
25 //______________________________________________________________________________
26 //
27 // TRefProxy is a reference proxy, which allows to access ROOT references (TRef)
28 // stored contained in other objects from TTree::Draw
29 //______________________________________________________________________________
30 
31 class TRefProxy : public TVirtualRefProxy {
32 protected:
33  TClassRef fClass; //! Pointer to the reference class (TRef::Class())
34 
35 public:
36  /// Default constructor
37  TRefProxy() : fClass("TRef") {}
38  /// Copy constructor
39  TRefProxy(const TRefProxy& c) : TVirtualRefProxy(), fClass(c.fClass) {}
40  /// Assignement operator
41  TRefProxy &operator=(const TRefProxy& c) { fClass =c.fClass; return *this; }
42 
43  /// TVirtualRefProxy overload: Release the reference proxy (virtual destructor)
44  virtual void Release() { delete this; }
45  /// TVirtualRefProxy overload: Clone the reference proxy (virtual constructor)
46  virtual TVirtualRefProxy* Clone() const { return new TRefProxy(*this);}
47  /// TVirtualRefProxy overload: Setter of reference class (executed when the proxy is adopted)
48  virtual void SetClass(TClass *cl) { fClass = cl; }
49  /// TVirtualRefProxy overload: Getter of reference class (executed when the proxy is adopted)
50  virtual TClass * GetClass() const { return fClass; }
51  /// TVirtualRefProxy overload: Access to value class
52  virtual TClass* GetValueClass(void* data) const;
53  /// TVirtualRefProxy overload: Prepare reused reference object (e.g. ZERO data pointers)
54  virtual void* GetPreparedReference(void* data) { return data; }
55  /// TVirtualRefProxy overload: Update (and propagate) cached information
56  virtual Bool_t Update();
57  /// TVirtualRefProxy overload: Flag to indicate if this is a container reference
58  virtual Bool_t HasCounter() const { return kFALSE; }
59  /// TVirtualRefProxy overload: Access to container size (if container reference (ie TRefArray) etc)
60  virtual Int_t GetCounterValue(TFormLeafInfoReference* /* info */, void* /* data */)
61  { return 0; }
62  /// TVirtualRefProxy overload: Access referenced object(-data)
63  virtual void* GetObject(TFormLeafInfoReference* info, void* data, int instance);
64 };
65 #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:48
virtual TClass * GetClass() const
TVirtualRefProxy overload: Getter of reference class (executed when the proxy is adopted) ...
Definition: TRefProxy.h:50
virtual TVirtualRefProxy * Clone() const
TVirtualRefProxy overload: Clone the reference proxy (virtual constructor)
Definition: TRefProxy.h:46
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t GetCounterValue(TFormLeafInfoReference *, void *)
TVirtualRefProxy overload: Access to container size (if container reference (ie TRefArray) etc) ...
Definition: TRefProxy.h:60
TRefProxy()
Pointer to the reference class (TRef::Class())
Definition: TRefProxy.h:37
virtual void * GetPreparedReference(void *data)
TVirtualRefProxy overload: Prepare reused reference object (e.g. ZERO data pointers) ...
Definition: TRefProxy.h:54
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:58
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
const Bool_t kFALSE
Definition: RtypesCore.h:92
TRefProxy & operator=(const TRefProxy &c)
Assignement operator.
Definition: TRefProxy.h:41
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:29
TRefProxy(const TRefProxy &c)
Copy constructor.
Definition: TRefProxy.h:39
virtual void Release()
TVirtualRefProxy overload: Release the reference proxy (virtual destructor)
Definition: TRefProxy.h:44
virtual void * GetObject(TFormLeafInfoReference *info, void *data, int instance)
TVirtualRefProxy overload: Access referenced object(-data)
Definition: TRefProxy.cxx:48
TClassRef fClass
Definition: TRefProxy.h:33