Logo ROOT  
Reference Guide
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 
26 class TBranchObject : public TBranch {
27 
28 protected:
29  enum EStatusBits {
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.
39  kOldWarn = BIT(12)
40  };
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_t isptrptr);
46 
47 public:
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_t isptrptr = kTRUE);
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_t isptrptr = kTRUE);
51  virtual ~TBranchObject();
52 
53  virtual void Browse(TBrowser *b);
54  virtual const char* GetClassName() const { return fClassName.Data(); };
55  virtual const char* GetObjClassName() { return fClassName.Data(); };
56  virtual Int_t GetEntry(Long64_t entry=0, Int_t getall = 0);
57  virtual Int_t GetExpectedType(TClass *&clptr,EDataType &type);
58  Bool_t IsFolder() const;
59  virtual void Print(Option_t *option="") const;
60  virtual void Reset(Option_t *option="");
62  virtual void SetAddress(void *addobj);
63  virtual void SetAutoDelete(Bool_t autodel=kTRUE);
64  virtual void SetBasketSize(Int_t buffsize);
65  virtual void SetupAddresses();
66  virtual void UpdateAddress();
67 
68 private:
70 
71  ClassDef(TBranchObject,1); //Branch in case of an object
72 };
73 
74 #endif
TFileMergeInfo
Definition: TFileMergeInfo.h:42
TBranchObject::SetupAddresses
virtual void SetupAddresses()
– If the branch address is not set, we set all addresses starting with the top level parent branch.
Definition: TBranchObject.cxx:594
TBrowser
Definition: TBrowser.h:37
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TBranchObject::fOldObject
TObject * fOldObject
!Pointer to old object
Definition: TBranchObject.h:49
TBranchObject::GetEntry
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of a BranchObject and return total number of bytes.
Definition: TBranchObject.cxx:206
TBranchObject::kWarn
@ kWarn
Definition: TBranchObject.h:42
TBranchObject::Init
void Init(TTree *tree, TBranch *parent, const char *name, const char *classname, void *addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, Bool_t isptrptr)
Initialization routine (run from the constructor so do not make this function virtual)
Definition: TBranchObject.cxx:68
TString::Data
const char * Data() const
Definition: TString.h:369
tree
Definition: tree.py:1
TBranch.h
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TTree
Definition: TTree.h:79
TBranchObject::~TBranchObject
virtual ~TBranchObject()
Destructor for a BranchObject.
Definition: TBranchObject.cxx:150
Int_t
int Int_t
Definition: RtypesCore.h:45
TBranchObject::FillImpl
virtual Int_t FillImpl(ROOT::Internal::TBranchIMTHelper *)
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranchObject.cxx:172
TBranchObject::Reset
virtual void Reset(Option_t *option="")
Reset a branch.
Definition: TBranchObject.cxx:298
TBranchObject::kOldWarn
@ kOldWarn
Definition: TBranchObject.h:45
TBranchObject::EStatusBitsOldValues
EStatusBitsOldValues
Definition: TBranchObject.h:44
TBranchObject::ResetAfterMerge
virtual void ResetAfterMerge(TFileMergeInfo *)
Reset a Branch after a Merge operation (drop data but keep customizations)
Definition: TBranchObject.cxx:311
TBranchObject::IsFolder
Bool_t IsFolder() const
Return TRUE if more than one leaf or if fBrowsables, FALSE otherwise.
Definition: TBranchObject.cxx:258
TBranchObject::UpdateAddress
virtual void UpdateAddress()
Update branch addresses if a new object was created.
Definition: TBranchObject.cxx:615
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TBranchObject::Browse
virtual void Browse(TBrowser *b)
Browse the branch content.
Definition: TBranchObject.cxx:158
b
#define b(i)
Definition: RSha256.hxx:118
bool
TBranchObject::SetAddress
virtual void SetAddress(void *addobj)
Set address of this branch.
Definition: TBranchObject.cxx:325
TBranch
Definition: TBranch.h:89
TBranchObject::GetObjClassName
virtual const char * GetObjClassName()
Definition: TBranchObject.h:61
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TBranchObject::TBranchObject
TBranchObject()
Default constructor for BranchObject.
Definition: TBranchObject.cxx:40
TBranchObject::GetExpectedType
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
Definition: TBranchObject.cxx:242
TBranchObject
Definition: TBranchObject.h:26
BIT
#define BIT(n)
Definition: Rtypes.h:85
TBranchObject::fClassName
TString fClassName
Class name of referenced object.
Definition: TBranchObject.h:48
TBranchObject::GetClassName
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any.
Definition: TBranchObject.h:60
TBranchObject::SetBasketSize
virtual void SetBasketSize(Int_t buffsize)
Reset basket size for all subbranches of this branch.
Definition: TBranchObject.cxx:531
TClass
Definition: TClass.h:80
EDataType
EDataType
Definition: TDataType.h:28
ROOT::Internal::TBranchIMTHelper
Definition: TBranchIMTHelper.h:38
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
TBranchObject::SetAutoDelete
virtual void SetAutoDelete(Bool_t autodel=kTRUE)
Set the AutoDelete bit.
Definition: TBranchObject.cxx:517
type
int type
Definition: TGX11.cxx:121
TBranchObject::Print
virtual void Print(Option_t *option="") const
Print TBranch parameters.
Definition: TBranchObject.cxx:274
TObject::EStatusBits
EStatusBits
Definition: TObject.h:57
ROOT::RCompressionSetting::EAlgorithm::kInherit
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition: Compression.h:98
int