Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TFormLeafInfo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/treeplayer:$Id$
0002 // Author: Philippe Canal 01/06/2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers and al.        *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TFormLeafInfo
0013 #define ROOT_TFormLeafInfo
0014 
0015 #include "TObject.h"
0016 
0017 #include "TLeafElement.h"
0018 
0019 #include "TArrayI.h"
0020 #include "TDataType.h"
0021 #include "TStreamerInfo.h"
0022 #include "TStreamerElement.h"
0023 
0024 
0025 // declare the extra versions of GetValue() plus templated implementation
0026 #define DECLARE_GETVAL(VIRTUAL, OVERRIDE) \
0027    VIRTUAL Double_t  GetValue(TLeaf *leaf, Int_t instance = 0) OVERRIDE               \
0028        { return GetValueImpl<Double_t>(leaf, instance); }                             \
0029    VIRTUAL Long64_t  GetValueLong64(TLeaf *leaf, Int_t instance = 0) OVERRIDE         \
0030        { return GetValueImpl<Long64_t>(leaf, instance); }                             \
0031    VIRTUAL LongDouble_t  GetValueLongDouble(TLeaf *leaf, Int_t instance = 0) OVERRIDE \
0032        { return GetValueImpl<LongDouble_t>(leaf, instance); }                         \
0033    template<typename T> T  GetValueImpl(TLeaf *leaf, Int_t instance = 0)   // no semicolon
0034 
0035 
0036 // declare the extra versions of ReadValue() plus templated implementation
0037 #define DECLARE_READVAL(VIRTUAL, OVERRIDE) \
0038    VIRTUAL Double_t ReadValue(char *where, Int_t instance = 0) OVERRIDE               \
0039        { return ReadValueImpl<Double_t>(where, instance); }                           \
0040    VIRTUAL Long64_t ReadValueLong64(char *where, Int_t instance = 0) OVERRIDE         \
0041        { return ReadValueImpl<Long64_t>(where, instance); }                           \
0042    VIRTUAL LongDouble_t ReadValueLongDouble(char *where, Int_t instance = 0) OVERRIDE \
0043        { return ReadValueImpl<LongDouble_t>(where, instance); }                       \
0044    template<typename T> T  ReadValueImpl(char *where, Int_t instance = 0)  // no semicolon
0045 
0046 
0047 class TFormLeafInfo : public TObject {
0048 public:
0049    // Constructors
0050    TFormLeafInfo(TClass* classptr = nullptr, Longptr_t offset = 0,
0051                  TStreamerElement* element = nullptr);
0052    TFormLeafInfo(const TFormLeafInfo& orig);
0053    virtual TFormLeafInfo* DeepCopy() const;
0054    ~TFormLeafInfo() override;
0055 
0056    void Swap(TFormLeafInfo &other);
0057    TFormLeafInfo &operator=(const TFormLeafInfo &orig);
0058 
0059    // Data Members
0060    TClass           *fClass;   ///<! This is the class of the data pointed to
0061    //TStreamerInfo  *fInfo;    ///<! == fClass->GetStreamerInfo()
0062    Longptr_t         fOffset;  ///<! Offset of the data pointed inside the class fClass
0063    TStreamerElement *fElement; ///<! Descriptor of the data pointed to.
0064          //Warning, the offset in fElement is NOT correct because it does not take into
0065          //account base classes and nested objects (which fOffset does).
0066    TFormLeafInfo    *fCounter;
0067    TFormLeafInfo    *fNext;    ///< follow this to grab the inside information
0068    TString fClassName;
0069    TString fElementName;
0070 
0071 protected:
0072    Int_t fMultiplicity;
0073 public:
0074 
0075    virtual void AddOffset(Int_t offset, TStreamerElement* element);
0076 
0077    virtual Int_t GetArrayLength();
0078    virtual TClass*   GetClass() const;
0079    virtual Int_t     GetCounterValue(TLeaf* leaf);
0080    virtual Int_t     ReadCounterValue(char *where);
0081 
0082    char* GetObjectAddress(TLeafElement* leaf, Int_t &instance);
0083 
0084    Int_t GetMultiplicity();
0085 
0086    // Currently only implemented in TFormLeafInfoCast
0087    Int_t GetNdata(TLeaf* leaf);
0088    virtual Int_t GetNdata();
0089 
0090    virtual void     *GetValuePointer(TLeaf *leaf, Int_t instance = 0);
0091    virtual void     *GetValuePointer(char  *from, Int_t instance = 0);
0092    virtual void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0);
0093    virtual void     *GetLocalValuePointer( char *from, Int_t instance = 0);
0094 
0095    virtual bool      HasCounter() const;
0096    virtual bool      IsString() const;
0097 
0098    virtual bool      IsInteger() const;
0099    virtual bool      IsReference() const  {  return false; }
0100 
0101    // Method for multiple variable dimensions.
0102    virtual Int_t GetPrimaryIndex();
0103    virtual Int_t GetVarDim();
0104    virtual Int_t GetVirtVarDim();
0105    virtual Int_t GetSize(Int_t index);
0106    virtual Int_t GetSumOfSizes();
0107    virtual void  LoadSizes(TBranch* branch);
0108    virtual void  SetPrimaryIndex(Int_t index);
0109    virtual void  SetSecondaryIndex(Int_t index);
0110    virtual void  SetSize(Int_t index, Int_t val);
0111    virtual void  SetBranch(TBranch* br)  { if ( fNext ) fNext->SetBranch(br); }
0112    virtual void  UpdateSizes(TArrayI *garr);
0113 
0114    virtual bool      Update();
0115 
0116    DECLARE_GETVAL(virtual,);
0117    DECLARE_READVAL(virtual,);
0118 
0119    template <typename T> struct ReadValueHelper {
0120       static T Exec(TFormLeafInfo *leaf, char *where, Int_t instance) {
0121          return leaf->ReadValue(where, instance);
0122       }
0123    };
0124    template <typename T > T ReadTypedValue(char *where, Int_t instance = 0) {
0125       return ReadValueHelper<T>::Exec(this, where, instance);
0126    }
0127 
0128    template <typename T> struct GetValueHelper {
0129       static T Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) {
0130          return linfo->GetValue(leaf, instance);
0131       }
0132    };
0133    template <typename T > T GetTypedValue(TLeaf *leaf, Int_t instance = 0) {
0134       return GetValueHelper<T>::Exec(this, leaf, instance);
0135    }
0136 };
0137 
0138 
0139 template <> struct TFormLeafInfo::ReadValueHelper<Long64_t> {
0140    static Long64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLong64(where, instance); }
0141 };
0142 template <> struct TFormLeafInfo::ReadValueHelper<ULong64_t> {
0143    static ULong64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return (ULong64_t)leaf->ReadValueLong64(where, instance); }
0144 };
0145 template <> struct TFormLeafInfo::ReadValueHelper<LongDouble_t> {
0146    static LongDouble_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLongDouble(where, instance); }
0147 };
0148 
0149 template <> struct TFormLeafInfo::GetValueHelper<Long64_t> {
0150    static Long64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLong64(leaf, instance); }
0151 };
0152 template <> struct TFormLeafInfo::GetValueHelper<ULong64_t> {
0153    static ULong64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return (ULong64_t)linfo->GetValueLong64(leaf, instance); }
0154 };
0155 template <> struct TFormLeafInfo::GetValueHelper<LongDouble_t> {
0156    static LongDouble_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLongDouble(leaf, instance); }
0157 };
0158 
0159 // TFormLeafInfoDirect is a small helper class to implement reading a data
0160 // member on an object stored in a TTree.
0161 
0162 class TFormLeafInfoDirect : public TFormLeafInfo {
0163 public:
0164    TFormLeafInfoDirect(TBranchElement * from);
0165    // The implicit default constructor's implementation is correct.
0166 
0167    TFormLeafInfo* DeepCopy() const override;
0168 
0169    DECLARE_GETVAL( , override);
0170    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0171    void     *GetLocalValuePointer(char *thisobj, Int_t instance = 0) override;
0172 
0173    Double_t  ReadValue(char * /*where*/, Int_t /*instance*/= 0) override;
0174    Long64_t  ReadValueLong64(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0175    LongDouble_t  ReadValueLongDouble(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0176 
0177 };
0178 
0179 // TFormLeafInfoNumerical is a small helper class to implement reading a
0180 // numerical value inside a collection
0181 
0182 class TFormLeafInfoNumerical : public TFormLeafInfo {
0183    EDataType fKind;
0184    bool      fIsBool;
0185 public:
0186    TFormLeafInfoNumerical(TVirtualCollectionProxy *holder_of);
0187    TFormLeafInfoNumerical(EDataType kind);
0188    TFormLeafInfoNumerical(const TFormLeafInfoNumerical& orig);
0189 
0190    TFormLeafInfo* DeepCopy() const override;
0191    void Swap(TFormLeafInfoNumerical &other);
0192    TFormLeafInfoNumerical &operator=(const TFormLeafInfoNumerical &orig);
0193 
0194    ~TFormLeafInfoNumerical() override;
0195 
0196    bool      IsString() const override;
0197    bool      Update() override;
0198 };
0199 
0200 // TFormLeafInfoCollectionObject
0201 // This class is used when we are interested by the collection it self and
0202 // it is split.
0203 
0204 class TFormLeafInfoCollectionObject : public TFormLeafInfo {
0205    bool fTop;  //If true, it indicates that the branch itself contains
0206 public:
0207    TFormLeafInfoCollectionObject(TClass* classptr = nullptr, bool fTop = true);
0208    TFormLeafInfoCollectionObject(const TFormLeafInfoCollectionObject &orig);
0209 
0210    void Swap(TFormLeafInfoCollectionObject &other);
0211    TFormLeafInfoCollectionObject &operator=(const TFormLeafInfoCollectionObject &orig);
0212 
0213    TFormLeafInfo* DeepCopy() const override {
0214       return new TFormLeafInfoCollectionObject(*this);
0215    }
0216 
0217    DECLARE_GETVAL( , override);
0218    Int_t     GetCounterValue(TLeaf* leaf) override;
0219    Double_t  ReadValue(char *where, Int_t instance = 0) override;
0220    Long64_t  ReadValueLong64(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0221    LongDouble_t  ReadValueLongDouble(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0222    void     *GetValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0223    void     *GetValuePointer(char  *thisobj, Int_t instance = 0) override;
0224    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0225    void     *GetLocalValuePointer(char  *thisobj, Int_t instance = 0) override;
0226 };
0227 
0228 // TFormLeafInfoClones is a small helper class to implement reading a data
0229 // member on a TClonesArray object stored in a TTree.
0230 
0231 class TFormLeafInfoClones : public TFormLeafInfo {
0232    bool fTop;  //If true, it indicates that the branch itself contains
0233 public:
0234    //either the clonesArrays or something inside the clonesArray
0235    TFormLeafInfoClones(TClass* classptr = nullptr, Longptr_t offset = 0);
0236    TFormLeafInfoClones(TClass* classptr, Longptr_t offset, bool top);
0237    TFormLeafInfoClones(TClass* classptr, Longptr_t offset, TStreamerElement* element,
0238                        bool top = false);
0239    TFormLeafInfoClones(const TFormLeafInfoClones &orig);
0240 
0241    void Swap(TFormLeafInfoClones &other);
0242    TFormLeafInfoClones &operator=(const TFormLeafInfoClones &orig);
0243 
0244    TFormLeafInfo* DeepCopy() const override {
0245       return new TFormLeafInfoClones(*this);
0246    }
0247 
0248    DECLARE_GETVAL( , override);
0249    DECLARE_READVAL( , override);
0250    Int_t     GetCounterValue(TLeaf* leaf) override;
0251    Int_t     ReadCounterValue(char *where) override;
0252    void     *GetValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0253    void     *GetValuePointer(char  *thisobj, Int_t instance = 0) override;
0254    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0255    void     *GetLocalValuePointer(char  *thisobj, Int_t instance = 0) override;
0256 };
0257 
0258 // TFormLeafInfoCollection is a small helper class to implement reading a data member
0259 // on a generic collection object stored in a TTree.
0260 
0261 class TFormLeafInfoCollection : public TFormLeafInfo {
0262    bool fTop;  //If true, it indicates that the branch itself contains
0263    //either the clonesArrays or something inside the clonesArray
0264    TClass                  *fCollClass;
0265    TString                  fCollClassName;
0266    TVirtualCollectionProxy *fCollProxy;
0267    TStreamerElement        *fLocalElement;
0268 public:
0269 
0270    TFormLeafInfoCollection(TClass* classptr,
0271                            Longptr_t offset,
0272                            TStreamerElement* element,
0273                            bool top = false);
0274 
0275    TFormLeafInfoCollection(TClass* motherclassptr,
0276                            Longptr_t offset = 0,
0277                            TClass* elementclassptr = nullptr,
0278                            bool top = false);
0279 
0280    TFormLeafInfoCollection();
0281    TFormLeafInfoCollection(const TFormLeafInfoCollection& orig);
0282 
0283    ~TFormLeafInfoCollection() override;
0284 
0285    void Swap(TFormLeafInfoCollection &other);
0286    TFormLeafInfoCollection &operator=(const TFormLeafInfoCollection &orig);
0287 
0288    TFormLeafInfo* DeepCopy() const override;
0289 
0290    bool      Update() override;
0291 
0292    DECLARE_GETVAL( , override);
0293    DECLARE_READVAL( , override);
0294    Int_t     GetCounterValue(TLeaf* leaf) override;
0295    Int_t     ReadCounterValue(char* where) override;
0296    virtual Int_t     GetCounterValue(TLeaf* leaf, Int_t instance);
0297    bool      HasCounter() const override;
0298    void     *GetValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0299    void     *GetValuePointer(char  *thisobj, Int_t instance = 0) override;
0300    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0301    void     *GetLocalValuePointer(char  *thisobj, Int_t instance = 0) override;
0302 };
0303 
0304 // TFormLeafInfoCollectionSize is used to return the size of a collection
0305 
0306 class TFormLeafInfoCollectionSize : public TFormLeafInfo {
0307    TClass                  *fCollClass;
0308    TString                  fCollClassName;
0309    TVirtualCollectionProxy *fCollProxy;
0310 public:
0311    TFormLeafInfoCollectionSize(TClass*);
0312    TFormLeafInfoCollectionSize(TClass* classptr,Longptr_t offset,TStreamerElement* element);
0313    TFormLeafInfoCollectionSize();
0314    TFormLeafInfoCollectionSize(const TFormLeafInfoCollectionSize& orig);
0315 
0316    ~TFormLeafInfoCollectionSize() override;
0317 
0318    void Swap(TFormLeafInfoCollectionSize &other);
0319    TFormLeafInfoCollectionSize &operator=(const TFormLeafInfoCollectionSize &orig);
0320 
0321    TFormLeafInfo* DeepCopy() const override;
0322 
0323    bool      Update() override;
0324 
0325    void     *GetValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0326    void     *GetValuePointer(char  *from, Int_t instance = 0) override;
0327    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0328    void     *GetLocalValuePointer( char *from, Int_t instance = 0) override;
0329    Double_t  ReadValue(char *where, Int_t instance = 0) override;
0330    Long64_t  ReadValueLong64(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0331    LongDouble_t  ReadValueLongDouble(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0332 };
0333 
0334 // TFormLeafInfoPointer is a small helper class to implement reading a data
0335 // member by following a pointer inside a branch of TTree.
0336 
0337 class TFormLeafInfoPointer : public TFormLeafInfo {
0338 public:
0339    TFormLeafInfoPointer(TClass* classptr = nullptr, Longptr_t offset = 0,
0340                         TStreamerElement* element = nullptr);
0341    // The default copy constructor is the right implementation.
0342 
0343    TFormLeafInfo* DeepCopy() const override;
0344 
0345    DECLARE_GETVAL( , override);
0346    DECLARE_READVAL( , override);
0347 };
0348 
0349 // TFormLeafInfoMethod is a small helper class to implement executing a method
0350 // of an object stored in a TTree
0351 
0352 class TFormLeafInfoMethod : public TFormLeafInfo {
0353 
0354    TMethodCall *fMethod;
0355    TString      fMethodName;
0356    TString      fParams;
0357    Double_t     fResult;
0358    TString      fCopyFormat;
0359    TString      fDeleteFormat;
0360    void        *fValuePointer;
0361    bool         fIsByValue;
0362 
0363 public:
0364    static TClass *ReturnTClass(TMethodCall *mc);
0365 
0366    TFormLeafInfoMethod(TClass* classptr = nullptr, TMethodCall *method = nullptr);
0367    TFormLeafInfoMethod(const TFormLeafInfoMethod& orig);
0368    ~TFormLeafInfoMethod() override;
0369 
0370    void Swap(TFormLeafInfoMethod &other);
0371    TFormLeafInfoMethod &operator=(const TFormLeafInfoMethod &orig);
0372 
0373    TFormLeafInfo* DeepCopy() const override;
0374 
0375    DECLARE_READVAL( , override);
0376    TClass*  GetClass() const override;
0377    void    *GetLocalValuePointer( TLeaf *from, Int_t instance = 0) override;
0378    void    *GetLocalValuePointer(char *from, Int_t instance = 0) override;
0379    bool     IsInteger() const override;
0380    bool     IsString() const override;
0381    bool     Update() override;
0382 };
0383 
0384 // TFormLeafInfoMultiVarDim is a small helper class to implement reading a
0385 // data member on a variable size array inside a TClonesArray object stored in
0386 // a TTree.  This is the version used when the data member is inside a
0387 // non-split object.
0388 
0389 class TFormLeafInfoMultiVarDim : public TFormLeafInfo {
0390 public:
0391    Int_t fNsize;
0392    TArrayI fSizes;           // Array of sizes of the variable dimension
0393    TFormLeafInfo *fCounter2; // Information on how to read the secondary dimensions
0394    Int_t fSumOfSizes;        // Sum of the content of fSizes
0395    Int_t fDim;               // physical number of the dimension that is variable
0396    Int_t fVirtDim;           // number of the virtual dimension to which this object correspond.
0397    Int_t fPrimaryIndex;      // Index of the dimensions that is indexing the second dimension's size
0398    Int_t fSecondaryIndex;    // Index of the second dimension
0399 
0400 protected:
0401    TFormLeafInfoMultiVarDim(TClass* classptr, Longptr_t offset,
0402                             TStreamerElement* element) : TFormLeafInfo(classptr,offset,element),fNsize(0),fSizes(),fCounter2(nullptr),fSumOfSizes(0),fDim(0),fVirtDim(0),fPrimaryIndex(-1),fSecondaryIndex(-1) {}
0403 
0404 public:
0405    TFormLeafInfoMultiVarDim(TClass* classptr, Longptr_t offset,
0406                             TStreamerElement* element, TFormLeafInfo* parent);
0407    TFormLeafInfoMultiVarDim();
0408    TFormLeafInfoMultiVarDim(const TFormLeafInfoMultiVarDim& orig);
0409    ~TFormLeafInfoMultiVarDim() override;
0410 
0411    void Swap(TFormLeafInfoMultiVarDim &other);
0412    TFormLeafInfoMultiVarDim &operator=(const TFormLeafInfoMultiVarDim &orig);
0413 
0414    TFormLeafInfo* DeepCopy() const override;
0415 
0416    /* The proper indexing and unwinding of index is done by prior leafinfo in the chain. */
0417    //virtual Double_t  ReadValue(char *where, Int_t instance = 0) {
0418    //   return TFormLeafInfo::ReadValue(where,instance);
0419    //}
0420 
0421    void     LoadSizes(TBranch* branch) override;
0422    Int_t    GetPrimaryIndex() override;
0423    void     SetPrimaryIndex(Int_t index) override;
0424    void     SetSecondaryIndex(Int_t index) override;
0425    void     SetSize(Int_t index, Int_t val) override;
0426    Int_t    GetSize(Int_t index) override;
0427    Int_t    GetSumOfSizes() override;
0428    Double_t GetValue(TLeaf * /*leaf*/, Int_t /*instance*/ = 0) override;
0429    Long64_t  GetValueLong64(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0430    LongDouble_t  GetValueLongDouble(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0431    Int_t    GetVarDim() override;
0432    Int_t    GetVirtVarDim() override;
0433    bool     Update() override;
0434    void     UpdateSizes(TArrayI *garr) override;
0435 };
0436 
0437 // TFormLeafInfoMultiVarDimDirect is a small helper class to implement reading
0438 // a data member on a variable size array inside a TClonesArray object stored
0439 // in a TTree.  This is the version used for split access
0440 
0441 class TFormLeafInfoMultiVarDimDirect : public TFormLeafInfoMultiVarDim {
0442 public:
0443    // The default constructor are the correct implementation.
0444 
0445    TFormLeafInfo* DeepCopy() const override;
0446 
0447    DECLARE_GETVAL( , override);
0448    Double_t  ReadValue(char * /*where*/, Int_t /*instance*/ = 0) override;
0449    Long64_t  ReadValueLong64(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0450    LongDouble_t  ReadValueLongDouble(char *where, Int_t i= 0) override { return ReadValue(where, i); }
0451 };
0452 
0453 // TFormLeafInfoMultiVarDimCollection is a small helper class to implement reading
0454 // a data member which is a collection inside a TClonesArray or collection object
0455 // stored in a TTree.  This is the version used for split access
0456 //
0457 class TFormLeafInfoMultiVarDimCollection : public TFormLeafInfoMultiVarDim {
0458 public:
0459    TFormLeafInfoMultiVarDimCollection(TClass* motherclassptr, Longptr_t offset,
0460       TClass* elementclassptr, TFormLeafInfo *parent);
0461    TFormLeafInfoMultiVarDimCollection(TClass* classptr, Longptr_t offset,
0462       TStreamerElement* element, TFormLeafInfo* parent);
0463    // The default copy constructor is the right implementation.
0464 
0465    TFormLeafInfo* DeepCopy() const override;
0466 
0467    Int_t GetArrayLength() override { return 0; }
0468    void      LoadSizes(TBranch* branch) override;
0469    Double_t  GetValue(TLeaf *leaf, Int_t instance = 0) override;
0470    Long64_t  GetValueLong64(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0471    LongDouble_t  GetValueLongDouble(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0472    DECLARE_READVAL( , override);
0473 };
0474 
0475 // TFormLeafInfoMultiVarDimClones is a small helper class to implement reading
0476 // a data member which is a TClonesArray inside a TClonesArray or collection object
0477 // stored in a TTree.  This is the version used for split access
0478 //
0479 class TFormLeafInfoMultiVarDimClones : public TFormLeafInfoMultiVarDim {
0480 public:
0481    TFormLeafInfoMultiVarDimClones(TClass* motherclassptr, Longptr_t offset,
0482       TClass* elementclassptr, TFormLeafInfo *parent);
0483    TFormLeafInfoMultiVarDimClones(TClass* classptr, Longptr_t offset,
0484       TStreamerElement* element, TFormLeafInfo* parent);
0485    // The default copy constructor is the right implementation.
0486 
0487    TFormLeafInfo* DeepCopy() const override;
0488 
0489    Int_t GetArrayLength() override { return 0; }
0490    void      LoadSizes(TBranch* branch) override;
0491    Double_t  GetValue(TLeaf *leaf, Int_t instance = 0) override;
0492    Long64_t  GetValueLong64(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0493    LongDouble_t  GetValueLongDouble(TLeaf *leaf, Int_t i= 0) override { return GetValue(leaf, i); }
0494    DECLARE_READVAL( , override);
0495 };
0496 
0497 // TFormLeafInfoCast is a small helper class to implement casting an object to
0498 // a different type (equivalent to dynamic_cast)
0499 
0500 class TFormLeafInfoCast : public TFormLeafInfo {
0501 public:
0502    TClass *fCasted;     //! Pointer to the class we are trying to case to
0503    TString fCastedName; //! Name of the class we are casting to.
0504    bool    fGoodCast;   //! Marked by ReadValue.
0505    bool    fIsTObject;  //! Indicated whether the fClass inherits from TObject.
0506 
0507    TFormLeafInfoCast(TClass* classptr = nullptr, TClass* casted = nullptr);
0508    TFormLeafInfoCast(const TFormLeafInfoCast& orig);
0509    ~TFormLeafInfoCast() override;
0510 
0511    void Swap(TFormLeafInfoCast &other);
0512    TFormLeafInfoCast &operator=(const TFormLeafInfoCast &orig);
0513 
0514    TFormLeafInfo* DeepCopy() const override;
0515 
0516    DECLARE_READVAL( , override);
0517    // Currently only implemented in TFormLeafInfoCast
0518    Int_t GetNdata() override;
0519    bool      Update() override;
0520 };
0521 
0522 // TFormLeafInfoTTree is a small helper class to implement reading
0523 // from the containing TTree object itself.
0524 
0525 class TFormLeafInfoTTree : public TFormLeafInfo {
0526    TTree   *fTree;
0527    TTree   *fCurrent;
0528    TString  fAlias;
0529 
0530 public:
0531    TFormLeafInfoTTree(TTree *tree = nullptr, const char *alias = nullptr, TTree *current = nullptr);
0532    TFormLeafInfoTTree(const TFormLeafInfoTTree& orig);
0533 
0534    void Swap(TFormLeafInfoTTree &other);
0535    TFormLeafInfoTTree &operator=(const TFormLeafInfoTTree &orig);
0536 
0537    TFormLeafInfo* DeepCopy() const override;
0538 
0539    using TFormLeafInfo::GetLocalValuePointer;
0540    using TFormLeafInfo::GetValue;
0541 
0542    DECLARE_GETVAL( , override);
0543    DECLARE_READVAL( , override);
0544    void     *GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) override;
0545    bool      Update() override;
0546 };
0547 
0548 
0549 #endif /* ROOT_TFormLeafInfo */
0550