00001 // @(#)root/meta:$Id: TRefProxy.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Markus Frank 20/05/2005 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TRefProxy 00013 #define ROOT_TRefProxy 00014 00015 #include <map> 00016 #include <string> 00017 00018 #ifndef ROOT_TVirtualRefProxy 00019 #include "TVirtualRefProxy.h" 00020 #endif 00021 00022 #ifndef ROOT_TClassRef 00023 #include "TClassRef.h" 00024 #endif 00025 00026 // Forward declarations 00027 class TFormLeafInfoReference; 00028 00029 //______________________________________________________________________________ 00030 // 00031 // TRefProxy is a reference proxy, which allows to access ROOT references (TRef) 00032 // stored contained in other objects from TTree::Draw 00033 //______________________________________________________________________________ 00034 00035 class TRefProxy : public TVirtualRefProxy { 00036 protected: 00037 TClassRef fClass; //! Pointer to the reference class (TRef::Class()) 00038 00039 public: 00040 /// Default constructor 00041 TRefProxy() : fClass("TRef") {} 00042 /// Copy constructor 00043 TRefProxy(const TRefProxy& c) : TVirtualRefProxy(), fClass(c.fClass) {} 00044 /// Standard destructor 00045 virtual ~TRefProxy(); 00046 /// TVirtualRefProxy overload: Release the reference proxy (virtual destructor) 00047 virtual void Release() { delete this; } 00048 /// TVirtualRefProxy overload: Clone the reference proxy (virtual constructor) 00049 virtual TVirtualRefProxy* Clone() const { return new TRefProxy(*this);} 00050 /// TVirtualRefProxy overload: Setter of reference class (executed when the proxy is adopted) 00051 virtual void SetClass(TClass *cl) { fClass = cl; } 00052 /// TVirtualRefProxy overload: Getter of reference class (executed when the proxy is adopted) 00053 virtual TClass * GetClass() const { return fClass; } 00054 /// TVirtualRefProxy overload: Access to value class 00055 virtual TClass* GetValueClass(void* data) const; 00056 /// TVirtualRefProxy overload: Prepare reused reference object (e.g. ZERO data pointers) 00057 virtual void* GetPreparedReference(void* data) { return data; } 00058 /// TVirtualRefProxy overload: Update (and propagate) cached information 00059 virtual Bool_t Update(); 00060 /// TVirtualRefProxy overload: Flag to indicate if this is a container reference 00061 virtual Bool_t HasCounter() const { return kFALSE; } 00062 /// TVirtualRefProxy overload: Access to container size (if container reference (ie TRefArray) etc) 00063 virtual Int_t GetCounterValue(TFormLeafInfoReference* /* info */, void* /* data */) 00064 { return 0; } 00065 /// TVirtualRefProxy overload: Access referenced object(-data) 00066 virtual void* GetObject(TFormLeafInfoReference* info, void* data, int instance); 00067 }; 00068 #endif // ROOT_TRefProxy