Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TBranchObject.h
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Rene Brun 11/02/96
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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_TBranchObject
13#define ROOT_TBranchObject
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TBranchObject //
19// //
20// A Branch for the case of an object. //
21//////////////////////////////////////////////////////////////////////////
22
23
24#include "TBranch.h"
25
26class TBranchObject : public TBranch {
27
28protected:
30 kWarn = BIT(14)
31 };
32
33 /// In version of ROOT older then v6.12, kWarn was set to BIT(12)
34 /// which overlaps with TBranch::kBranchObject. Since it stored
35 /// in ROOT files as part of the TBranchObject and that we want
36 /// to reset in TBranchObject::Streamer, we need to keep track
37 /// of the old value.
41
42 TString fClassName; ///< Class name of referenced object
43 TObject *fOldObject; ///< !Pointer to old object
44
45 void Init(TTree *tree, TBranch *parent, const char *name, const char *classname, void *addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, bool isptrptr);
46
47public:
49 TBranchObject(TBranch *parent, const char *name, const char *classname, void *addobj, Int_t basketsize=32000, Int_t splitlevel = 0, Int_t compress = ROOT::RCompressionSetting::EAlgorithm::kInherit, bool isptrptr = true);
50 TBranchObject(TTree *tree, const char *name, const char *classname, void *addobj, Int_t basketsize=32000, Int_t splitlevel = 0, Int_t compress = ROOT::RCompressionSetting::EAlgorithm::kInherit, bool isptrptr = true);
51 ~TBranchObject() override;
52
53 void Browse(TBrowser *b) override;
54 const char* GetClassName() const override { return fClassName.Data(); };
55 virtual const char* GetObjClassName() { return fClassName.Data(); };
56 Int_t GetEntry(Long64_t entry=0, Int_t getall = 0) override;
57 Int_t GetExpectedType(TClass *&clptr,EDataType &type) override;
58 bool IsFolder() const override;
59 void Print(Option_t *option="") const override;
60 void Reset(Option_t *option="") override;
61 void ResetAfterMerge(TFileMergeInfo *) override;
62 void SetAddress(void *addobj) override;
63 void SetAutoDelete(bool autodel=true) override;
64 void SetBasketSize(Int_t bufsize) override;
65 void SetupAddresses() override;
66 void UpdateAddress() override;
67
68private:
70
71 ClassDefOverride(TBranchObject,1); //Branch in case of an object
72};
73
74#endif
#define b(i)
Definition RSha256.hxx:100
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
EDataType
Definition TDataType.h:28
char name[80]
Definition TGX11.cxx:148
A helper class for managing IMT work during TTree:Fill operations.
void SetAddress(void *addobj) override
Set address of this branch.
void ResetAfterMerge(TFileMergeInfo *) override
Reset a Branch after a Merge operation (drop data but keep customizations).
const char * GetClassName() const override
Return the name of the user class whose content is stored in this branch, if any.
EStatusBitsOldValues
In version of ROOT older then v6.12, kWarn was set to BIT(12) which overlaps with TBranch::kBranchObj...
TObject * fOldObject
!Pointer to old object
bool IsFolder() const override
Return TRUE if more than one leaf or if fBrowsables, FALSE otherwise.
void SetBasketSize(Int_t bufsize) override
Reset basket size for all subbranches of this branch.
void SetupAddresses() override
– If the branch address is not set, we set all addresses starting with the top level parent branch.
Int_t GetExpectedType(TClass *&clptr, EDataType &type) override
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
void UpdateAddress() override
Update branch addresses if a new object was created.
void Init(TTree *tree, TBranch *parent, const char *name, const char *classname, void *addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, bool isptrptr)
Initialization routine (run from the constructor so do not make this function virtual).
virtual const char * GetObjClassName()
void SetAutoDelete(bool autodel=true) override
Set the AutoDelete bit.
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
Read all branches of a BranchObject and return total number of bytes.
TString fClassName
Class name of referenced object.
~TBranchObject() override
Destructor for a BranchObject.
TBranchObject()
Default constructor for BranchObject.
void Print(Option_t *option="") const override
Print TBranch parameters.
Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *) override
Loop on all leaves of this branch to fill Basket buffer.
void Reset(Option_t *option="") override
Reset a branch.
void Browse(TBrowser *b) override
Browse the branch content.
friend class TTree
Definition TBranch.h:100
TBranch(const TBranch &)=delete
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
A class to pass information from the TFileMerger to the objects being merged.
TObject()
TObject constructor.
Definition TObject.h:259
Basic string class.
Definition TString.h:138
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition Compression.h:91