00001 // @(#)root/treeplayer:$Id: TFormLeafInfoReference.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Markus Frank 01/02/2006 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers and al. * 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_TFormLeafInfoReference 00013 #define ROOT_TFormLeafInfoReference 00014 00015 #ifndef ROOT_TFormLeafInfo 00016 #include "TFormLeafInfo.h" 00017 #endif 00018 00019 #include <string> 00020 00021 // Forward declarations 00022 class TVirtualRefProxy; 00023 00024 ////////////////////////////////////////////////////////////////////////// 00025 // // 00026 // TFormLeafInfoReference // 00027 // // 00028 // TFormLeafInfoReference is a small helper class to implement the // 00029 // following of reference objects stored in a TTree // 00030 // // 00031 ////////////////////////////////////////////////////////////////////////// 00032 class TFormLeafInfoReference : public TFormLeafInfo { 00033 typedef TVirtualRefProxy Proxy; 00034 public: 00035 Proxy* fProxy; //! Cached pointer to reference proxy 00036 TBranch* fBranch; //! Cached pointer to branch object 00037 public: 00038 // Initializing constructor 00039 TFormLeafInfoReference(TClass* classptr, TStreamerElement* element, int off); 00040 // Copy constructor 00041 TFormLeafInfoReference(const TFormLeafInfoReference& orig); 00042 // Default destructor 00043 virtual ~TFormLeafInfoReference(); 00044 // Virtual copy constructor 00045 virtual TFormLeafInfo* DeepCopy() const; 00046 00047 // Access to the info's proxy 00048 Proxy* GetProxy() const { return fProxy; } 00049 // Access to the info's connected branch 00050 TBranch* GetBranch() const { return fBranch; } 00051 // Access to the info's connected branch 00052 void SetBranch(TBranch* branch) 00053 { fBranch = branch; if ( fNext ) fNext->SetBranch(branch); } 00054 // Access to the offset of the data 00055 virtual Int_t GetOffset() const { return fOffset; } 00056 // Return true only if the underlying data is an integral value 00057 virtual Bool_t IsInteger() const { return kFALSE; } 00058 // Return true only if the underlying data is a string 00059 virtual Bool_t IsString() const { return kFALSE; } 00060 // Return true only if the underlying data is a reference 00061 virtual Bool_t IsReference() const { return kTRUE; } 00062 // Access to target class pointer (if available) 00063 virtual TClass* GetClass() const; 00064 // Access to the value class of the reference proxy 00065 virtual TClass* GetValueClass(TLeaf* from); 00066 // Access to the value class from the object pointer 00067 virtual TClass* GetValueClass(void* from); 00068 // Return the address of the local value 00069 virtual void *GetLocalValuePointer( TLeaf *from, Int_t instance = 0); 00070 // Return the address of the local value 00071 virtual void *GetLocalValuePointer(char *from, Int_t instance = 0); 00072 // Return true if any of underlying data has a array size counter 00073 virtual Bool_t HasCounter() const; 00074 // Return the size of the underlying array for the current entry in the TTree. 00075 virtual Int_t ReadCounterValue(char *where); 00076 // Return the current size of the array container 00077 virtual Int_t GetCounterValue(TLeaf* leaf); 00078 00079 // Access value of referenced object 00080 virtual Double_t GetValue(TLeaf *leaf, Int_t instance); 00081 // Read value of referenced object 00082 virtual Double_t ReadValue(char *where, Int_t instance = 0); 00083 // TFormLeafInfo overload: Update (and propagate) cached information 00084 virtual Bool_t Update(); 00085 }; 00086 #endif /* ROOT_TFormLeafInfoReference */