Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:30

0001 // @(#)root/tree:$Id$
0002 // Author: Axel Naumann, 2010-10-12
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
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_TTreeReaderUtils
0013 #define ROOT_TTreeReaderUtils
0014 
0015 
0016 ////////////////////////////////////////////////////////////////////////////
0017 //                                                                        //
0018 // TTreeReaderUtils                                                       //
0019 //                                                                        //
0020 // TTreeReader's helpers.                                                 //
0021 //                                                                        //
0022 //                                                                        //
0023 ////////////////////////////////////////////////////////////////////////////
0024 
0025 #include "TBranchProxyDirector.h"
0026 #include "TBranchProxy.h"
0027 #include "TTreeReaderValue.h"
0028 
0029 #include <string>
0030 
0031 class TDictionary;
0032 class TTree;
0033 
0034 namespace ROOT {
0035    namespace Detail {
0036       class TBranchProxy;
0037    }
0038 
0039 namespace Internal {
0040    class TBranchProxyDirector;
0041    class TTreeReaderArrayBase;
0042 
0043    class TNamedBranchProxy {
0044    public:
0045       TNamedBranchProxy(): fDict(nullptr), fContentDict(nullptr) {}
0046       TNamedBranchProxy(TBranchProxyDirector* boss, TBranch* branch, const char* fullname, const char* membername):
0047          fProxy(boss, fullname, branch, membername), fDict(nullptr), fContentDict(nullptr), fFullName(fullname) {}
0048 
0049       // Constructor for friend case, the fullname (containing the name of the friend tree) may be different
0050       // from the lookup name (without the name of the friend)
0051       TNamedBranchProxy(TBranchProxyDirector* boss, TBranch* branch, const char* fullname, const char* proxyname, const char* membername):
0052          fProxy(boss, proxyname, branch, membername), fDict(nullptr), fContentDict(nullptr), fFullName(fullname) {}
0053 
0054       const char* GetName() const { return fFullName.c_str(); }
0055       const Detail::TBranchProxy* GetProxy() const { return &fProxy; }
0056       Detail::TBranchProxy* GetProxy() { return &fProxy; }
0057       TDictionary* GetDict() const { return fDict; }
0058       void SetDict(TDictionary* dict) { fDict = dict; }
0059       TDictionary* GetContentDict() const { return fContentDict; }
0060       void SetContentDict(TDictionary* dict) { fContentDict = dict; }
0061 
0062    private:
0063       Detail::TBranchProxy fProxy;
0064       TDictionary*         fDict;
0065       TDictionary*         fContentDict; // type of content, if a collection
0066       std::string          fFullName;
0067    };
0068 
0069    // Used by TTreeReaderArray
0070    class TVirtualCollectionReader {
0071    public:
0072       TTreeReaderValueBase::EReadStatus fReadStatus;
0073 
0074       TVirtualCollectionReader() : fReadStatus(TTreeReaderValueBase::kReadNothingYet) {}
0075 
0076       virtual ~TVirtualCollectionReader();
0077       virtual size_t GetSize(Detail::TBranchProxy*) = 0;
0078       virtual void* At(Detail::TBranchProxy*, size_t /*idx*/) = 0;
0079    };
0080 
0081 }
0082 }
0083 
0084 #endif // defined TTreeReaderUtils