Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 "TVirtualRefProxy.h"
16 
17 #include "TClassRef.h"
18 
19 #include <map>
20 #include <string>
21 
22 // Forward declarations
23 class TFormLeafInfoReference;
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