Logo ROOT  
Reference Guide
TTreeReaderUtils.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Axel Naumann, 2010-10-12
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, 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_TTreeReaderUtils
13 #define ROOT_TTreeReaderUtils
14 
15 
16 ////////////////////////////////////////////////////////////////////////////
17 // //
18 // TTreeReaderUtils //
19 // //
20 // TTreeReader's helpers. //
21 // //
22 // //
23 ////////////////////////////////////////////////////////////////////////////
24 
25 #include "TBranchProxyDirector.h"
26 #include "TBranchProxy.h"
27 #include "TTreeReaderValue.h"
28 
29 #include <string>
30 
31 class TDictionary;
32 class TTree;
33 
34 namespace ROOT {
35  namespace Detail {
36  class TBranchProxy;
37  }
38 
39 namespace Internal {
40  class TBranchProxyDirector;
41  class TTreeReaderArrayBase;
42 
44  public:
46  TNamedBranchProxy(TBranchProxyDirector* boss, TBranch* branch, const char* fullname, const char* membername):
47  fProxy(boss, fullname, branch, membername), fDict(0), fContentDict(0), fFullName(fullname) {}
48 
49  // Constructor for friend case, the fullname (containing the name of the friend tree) may be different
50  // from the lookup name (without the name of the friend)
51  TNamedBranchProxy(TBranchProxyDirector* boss, TBranch* branch, const char* fullname, const char* proxyname, const char* membername):
52  fProxy(boss, proxyname, branch, membername), fDict(0), fContentDict(0), fFullName(fullname) {}
53 
54  const char* GetName() const { return fFullName.c_str(); }
55  const Detail::TBranchProxy* GetProxy() const { return &fProxy; }
57  TDictionary* GetDict() const { return fDict; }
58  void SetDict(TDictionary* dict) { fDict = dict; }
60  void SetContentDict(TDictionary* dict) { fContentDict = dict; }
61 
62  private:
65  TDictionary* fContentDict; // type of content, if a collection
66  std::string fFullName;
67  };
68 
69  // Used by TTreeReaderArray
71  public:
73 
75 
76  virtual ~TVirtualCollectionReader();
77  virtual size_t GetSize(Detail::TBranchProxy*) = 0;
78  virtual void* At(Detail::TBranchProxy*, size_t /*idx*/) = 0;
79  };
80 
81 }
82 }
83 
84 #endif // defined TTreeReaderUtils
ROOT::Internal::TNamedBranchProxy::TNamedBranchProxy
TNamedBranchProxy()
Definition: TTreeReaderUtils.h:45
ROOT::Internal::TBranchProxyDirector
Definition: TBranchProxyDirector.h:35
ROOT::Internal::TVirtualCollectionReader::~TVirtualCollectionReader
virtual ~TVirtualCollectionReader()
Definition: TTreeReaderArray.cxx:36
TTreeReaderValue.h
ROOT::Internal::TNamedBranchProxy::TNamedBranchProxy
TNamedBranchProxy(TBranchProxyDirector *boss, TBranch *branch, const char *fullname, const char *membername)
Definition: TTreeReaderUtils.h:46
ROOT::Internal::TVirtualCollectionReader::fReadStatus
TTreeReaderValueBase::EReadStatus fReadStatus
Definition: TTreeReaderUtils.h:72
ROOT::Internal::TNamedBranchProxy::SetDict
void SetDict(TDictionary *dict)
Definition: TTreeReaderUtils.h:58
ROOT::Internal::TNamedBranchProxy::fContentDict
TDictionary * fContentDict
Definition: TTreeReaderUtils.h:65
TTree
A TTree represents a columnar dataset.
Definition: TTree.h:79
ROOT::Internal::TNamedBranchProxy::GetName
const char * GetName() const
Definition: TTreeReaderUtils.h:54
ROOT::Internal::TVirtualCollectionReader::At
virtual void * At(Detail::TBranchProxy *, size_t)=0
ROOT::Internal::TNamedBranchProxy::TNamedBranchProxy
TNamedBranchProxy(TBranchProxyDirector *boss, TBranch *branch, const char *fullname, const char *proxyname, const char *membername)
Definition: TTreeReaderUtils.h:51
ROOT::Internal::TNamedBranchProxy::GetContentDict
TDictionary * GetContentDict() const
Definition: TTreeReaderUtils.h:59
TBranchProxy.h
ROOT::Internal::TNamedBranchProxy::GetProxy
Detail::TBranchProxy * GetProxy()
Definition: TTreeReaderUtils.h:56
ROOT::Internal::TNamedBranchProxy::GetDict
TDictionary * GetDict() const
Definition: TTreeReaderUtils.h:57
TBranch
A TTree is a list of TBranches.
Definition: TBranch.h:89
ROOT::Internal::TNamedBranchProxy::GetProxy
const Detail::TBranchProxy * GetProxy() const
Definition: TTreeReaderUtils.h:55
ROOT::Internal::TNamedBranchProxy::SetContentDict
void SetContentDict(TDictionary *dict)
Definition: TTreeReaderUtils.h:60
ROOT::Internal::TNamedBranchProxy::fProxy
Detail::TBranchProxy fProxy
Definition: TTreeReaderUtils.h:63
TBranchProxyDirector.h
TDictionary
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:162
ROOT::Detail::TBranchProxy
Base class for all the proxy object.
Definition: TBranchProxy.h:69
ROOT::Internal::TVirtualCollectionReader::GetSize
virtual size_t GetSize(Detail::TBranchProxy *)=0
ROOT::Internal::TNamedBranchProxy::fDict
TDictionary * fDict
Definition: TTreeReaderUtils.h:64
ROOT::Internal::TVirtualCollectionReader
Definition: TTreeReaderUtils.h:70
ROOT::Internal::TVirtualCollectionReader::TVirtualCollectionReader
TVirtualCollectionReader()
Definition: TTreeReaderUtils.h:74
ROOT::Internal::TTreeReaderValueBase
Base class of TTreeReaderValue.
Definition: TTreeReaderValue.h:44
ROOT::Internal::TNamedBranchProxy
Definition: TTreeReaderUtils.h:43
ROOT::Internal::TTreeReaderValueBase::EReadStatus
EReadStatus
Definition: TTreeReaderValue.h:67
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Internal::TNamedBranchProxy::fFullName
std::string fFullName
Definition: TTreeReaderUtils.h:66