13#ifndef ROOT_TTreeReaderValue
14#define ROOT_TTreeReaderValue
79 template <BranchProxyRead_t Func>
148 friend class ::TTreeReader;
181 TTreeReaderValueBase(&tr, branchname,
192 ErrorAboutMissingProxyIfNeeded();
195 void *address = GetAddress();
196 return fProxy->IsaPointer() ? *(T **)address : (T *)address;
212 static const std::string sElementTypeName = GetElementTypeName(
typeid(T));
213 return sElementTypeName.data();
Base class for all the proxy object.
Read a value in a branch without knowledge of its type.
const char * GetDerivedTypeName() const
TTreeReaderOpaqueValue(TTreeReader &tr, const char *branchname)
Base class of TTreeReaderValue.
void RegisterWithTreeReader()
Register with tree reader.
ESetupStatus
Status flags, 0 is good.
@ kSetupMatchBranch
This branch has been set up, branch data type and reader template type match, reading should succeed.
@ kSetupInternalError
Some other error - hopefully the error message helps.
@ kSetupMissingBranch
The specified branch cannot be found.
@ kSetupNotSetup
No initialization has happened yet.
@ kSetupMakeClassModeMismatch
readers disagree on whether TTree::SetMakeBranch() should be on
@ kSetupNotACollection
The branch class type is not a collection.
@ kSetupMissingDictionary
To read this branch, we need a dictionary.
@ kSetupMissingCounterBranch
The array cannot find its counter branch: Array[CounterBranch].
@ kSetupMismatch
Mismatch of branch type and reader template type.
@ kSetupTreeDestructed
The TTreeReader has been destructed / not set.
@ kSetupMatchLeaf
This branch (or TLeaf, really) has been set up, reading should succeed.
@ kSetupMatch
This branch has been set up, branch data type and reader template type match, reading should succeed.
ESetupStatus GetSetupStatus() const
Return this TTreeReaderValue's setup status.
Read_t fProxyReadFunc
! Pointer to the Read implementation to use.
bool fOpaqueRead
If true, the reader will not do any type-checking against the actual type held by the branch.
EReadStatus(TTreeReaderValueBase::* Read_t)()
void NotifyNewTree(TTree *newTree)
The TTreeReader has switched to a new TTree. Update the leaf.
bool fHaveLeaf
Whether the data is in a leaf.
void MarkTreeReaderUnavailable()
Detail::TBranchProxy * GetProxy() const
bool fHaveStaticClassOffsets
Whether !fStaticClassOffsets.empty()
void * GetAddress()
Returns the memory address of the object being read.
@ kReadError
Problem reading data.
@ kReadSuccess
Data read okay.
@ kReadNothingYet
Data now yet accessed.
static std::string GetElementTypeName(const std::type_info &ti)
Stringify the template argument.
ESetupStatus fSetupStatus
Setup status of this data access.
bool IsValid() const
Return true if the branch was setup and read correctly.
virtual const char * GetDerivedTypeName() const =0
TString fBranchName
Name of the branch to read data from.
ROOT::Internal::TTreeReaderValueBase::EReadStatus ProxyReadTemplate()
Try to read the value from the TBranchProxy, returns the status of the read.
TTreeReader * fTreeReader
Tree reader we belong to.
TDictionary * fDict
Type that the branch should contain.
TTreeReaderValueBase & operator=(const TTreeReaderValueBase &)
Copy-assign.
EReadStatus fReadStatus
Read status of this data access.
const char * GetBranchName() const
void ErrorAboutMissingProxyIfNeeded()
TLeaf * GetLeaf()
If we are reading a leaf, return the corresponding TLeaf.
virtual ~TTreeReaderValueBase()
Unregister from tree reader, cleanup.
bool(ROOT::Detail::TBranchProxy::* BranchProxyRead_t)()
EReadStatus ProxyReadDefaultImpl()
virtual void CreateProxy()
Create the proxy object for our branch.
virtual EReadStatus GetReadStatus() const
Detail::TBranchProxy * fProxy
Proxy for this branch, owned by TTreeReader.
std::vector< Long64_t > fStaticClassOffsets
TBranch * SearchBranchWithCompositeName(TLeaf *&myleaf, TDictionary *&branchActualType, std::string &err)
Search a branch the name of which contains a ".".
static const char * GetBranchDataType(TBranch *branch, TDictionary *&dict, TDictionary const *curDict)
Retrieve the type of data stored by branch; put its dictionary into dict, return its type name.
A Branch for the case of an object.
A TTree is a list of TBranches.
This class defines an abstract interface that must be implemented by all classes that contain diction...
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
An interface for reading values stored in ROOT columnar datasets.
T * operator->()
Return a pointer to the value of the current entry.
TTreeReaderValue()=delete
T * Get()
Return a pointer to the value of the current entry.
TTreeReaderValue(TTreeReader &tr, const char *branchname)
T & operator*()
Return a reference to the value of the current entry.
typename std::remove_const< T >::type NonConstT_t
const char * GetDerivedTypeName() const override
Get the template argument as a string.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
A TTree represents a columnar dataset.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...