Skip to content
Snippets Groups Projects
Commit 70821f21 authored by Philippe Canal's avatar Philippe Canal
Browse files

From Paul Russo:

     o (fBranchPointer), (fBranchTypes)

       Removed, no longer used.

     o (BuildTitle), (SetBranchCount), (SetBranchCount2),
       (Unroll), (ValidateAddress)

       Convert to private member functions, they are
       implementation-only functions and should not be
       part of the public interface.

     o (Branch) Removed, unused junk code.

     o (CheckBranchID) Removed, no longer used.

     o (ReleaseObject) Added, implementation-only function used
       by SetAddress() and ResetAddress().

     o (GetAddress) Added override so that we may catch the
       case where the user changed the object pointer without
       notifying us with SetAddress().

     o (GetBranchOffset) Added so we can see full internals of
       the result of SetAddress().

     o (GetDataMemberOffset), (GetDataMemberOffsetEx)

       Removed, implementation-only member functions which
       are no longer used.

     o (GetInfo) Made const.

     o (GetObject) Made not inline so that we can make sure
       that the user did not change the object pointer without
       notifying us.

     o (IsObjectOwner) Added so that we can tell if the branch
       element owns the allocated object or not (if the element
       does then the user should not delete the object).

     o (Notify) Use SetAddress() to change fAddress to zero
       so that any allocated object may be released.

     o (ResetDeleteObject) Added so that cloned trees have a
       way of making themselves not the owner of the object
       allocated by SetAddress().

     o (SetAutoDelete) Removed, we don't implement it anymore
       since our implementation just called the TBranch
       implementation so we can just inherit it without
       overriding it.

     o (SetClassName), (SetParentName) Removed, users should
       not be allowed to change these data members, because
       they have complicated semantics tied to other class
       data members which would have to be changed to match
       and we should not allow the user to put us into an
       invalid state.


git-svn-id: http://root.cern.ch/svn/root/trunk@15784 27541ba8-7e3a-0410-8455-c3a389f83636
parent 8a0381a3
No related branches found
No related tags found
No related merge requests found
// @(#)root/tree:$Name: $:$Id: TBranchElement.h,v 1.48 2006/05/12 12:24:27 brun Exp $
// @(#)root/tree:$Name: $:$Id: TBranchElement.h,v 1.49 2006/05/23 04:47:42 brun Exp $
// Author: Rene Brun 14/01/2001
/*************************************************************************
......@@ -35,110 +35,117 @@ class TVirtualCollectionProxy;
class TBranchElement : public TBranch {
protected:
enum { kBranchFolder = BIT(14), kDeleteObject = BIT(16) };
TString fClassName; //Class name of referenced object
TString fParentName; //Name of parent class
TString fClonesName; //Name of class in TClonesArray (if any)
TVirtualCollectionProxy* fCollProxy; //! collection interface (if any)
UInt_t fCheckSum; //CheckSum of class
Int_t fClassVersion; //Version number of class
Int_t fID; //element serial number in fInfo
Int_t fType; //branch type
Int_t fStreamerType; //branch streamer type
Int_t fMaximum; //Maximum entries for a TClonesArray or variable array
Int_t fSTLtype; //!STL container type
Int_t fNdata; //!Number of data in this branch
TBranchElement *fBranchCount; //pointer to primary branchcount branch
TBranchElement *fBranchCount2; //pointer to secondary branchcount branch
TStreamerInfo *fInfo; //!Pointer to StreamerInfo
char *fObject; //!Pointer to object at *fAddress
char *fBranchPointer; //!Pointer to object for a master branch
Bool_t fInit; //!Initialization flag for branch assignment
Bool_t fInitOffsets; //!Initialization flag to not endlessly recalculate offsets
TClassRef fCurrentClass; //!Reference to current (transient) class definition
TClassRef fParentClass; //!Reference to class definition in fParentName
TClassRef fBranchClass; //!Reference to class definition in fClassName
Int_t *fBranchOffset; //!Sub-Branch offsets with respect to current transient class
Bool_t *fBranchTypes; //!Sub-Branch types (TBranchElement or not)
// Friends
friend class TTreeCloner;
// Types
protected:
enum {
kBranchFolder = BIT(14),
kDeleteObject = BIT(16) // We are the owner of fObject.
};
// Data Members
protected:
TString fClassName; // Class name of referenced object
TString fParentName; // Name of parent class
TString fClonesName; // Name of class in TClonesArray (if any)
TVirtualCollectionProxy *fCollProxy; //! collection interface (if any)
UInt_t fCheckSum; // CheckSum of class
Int_t fClassVersion; // Version number of class
Int_t fID; // element serial number in fInfo
Int_t fType; // branch type
Int_t fStreamerType; // branch streamer type
Int_t fMaximum; // Maximum entries for a TClonesArray or variable array
Int_t fSTLtype; //! STL container type
Int_t fNdata; //! Number of data in this branch
TBranchElement *fBranchCount; // pointer to primary branchcount branch
TBranchElement *fBranchCount2; // pointer to secondary branchcount branch
TStreamerInfo *fInfo; //! Pointer to StreamerInfo
char *fObject; //! Pointer to object at *fAddress
Bool_t fInit; //! Initialization flag for branch assignment
Bool_t fInitOffsets; //! Initialization flag to not endlessly recalculate offsets
TClassRef fCurrentClass; //! Reference to current (transient) class definition
TClassRef fParentClass; //! Reference to class definition in fParentName
TClassRef fBranchClass; //! Reference to class definition in fClassName
Int_t *fBranchOffset; //! Sub-Branch offsets with respect to current transient class
// Forbidden functions (implemented but you should not use them!)
protected:
TBranchElement(const TBranchElement&);
TBranchElement& operator=(const TBranchElement&);
// Implementation use only functions.
private:
void BuildTitle(const char* name);
void InitializeOffsets();
Bool_t CheckBranchID();
Bool_t IsMissingCollection() const;
TClass* GetCurrentClass(); // Class referenced by transient description
TClass* GetParentClass(); // Class referenced by fParentName
Bool_t IsMissingCollection() const;
TClass *GetCurrentClass(); // Class referenced by transient description
TClass *GetParentClass(); // Class referenced by fParentName
TVirtualCollectionProxy *GetCollectionProxy();
Int_t GetDataMemberOffset(const TClass *cl, const char *name);
Int_t GetDataMemberOffsetEx(TClass* par_cl, TString& parentName, Int_t off);
void ReleaseObject();
void SetBranchCount(TBranchElement* bre);
void SetBranchCount2(TBranchElement* bre) { fBranchCount2 = bre; }
Int_t Unroll(const char* name, TClass* cltop, TClass* cl, char* ptr, Int_t basketsize, Int_t splitlevel, Int_t btype);
void ValidateAddress() const;
// Public Interface.
public:
TBranchElement();
TBranchElement(const char *name, TStreamerInfo *sinfo, Int_t id, char *pointer, Int_t basketsize=32000, Int_t splitlevel = 0, Int_t btype=0);
TBranchElement(const char *name, TClonesArray *clones, Int_t basketsize=32000, Int_t splitlevel = 0, Int_t compress=-1);
TBranchElement(const char *name, TVirtualCollectionProxy *cont, Int_t basketsize=32000, Int_t splitlevel = 0, Int_t compress=-1);
virtual ~TBranchElement();
virtual Int_t Branch(const char *folder, Int_t bufsize=32000, Int_t splitlevel=99);
virtual TBranch *Branch(const char *name, void *address, const char *leaflist, Int_t bufsize=32000);
virtual TBranch *Branch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99);
virtual void Browse(TBrowser *b);
void BuildTitle(const char *name);
Int_t Fill();
void FillLeaves(TBuffer &b);
TBranchElement *GetBranchCount() const {return fBranchCount;}
TBranchElement *GetBranchCount2() const {return fBranchCount2;}
UInt_t GetCheckSum() {return fCheckSum;}
virtual const char *GetClassName() const {return fClassName.Data();}
virtual const char *GetClonesName() const {return fClonesName.Data();}
Int_t GetEntry(Long64_t entry=0, Int_t getall = 0);
const char *GetIconName() const;
Int_t GetID() const {return fID;}
TStreamerInfo *GetInfo();
char *GetObject() const { return fObject; };
virtual const char *GetParentName() const {return fParentName.Data();}
virtual Int_t GetMaximum() const;
Int_t GetNdata() const {return fNdata;};
Int_t GetType() const {return fType;}
Int_t GetStreamerType() const {return fStreamerType;}
virtual const char *GetTypeName() const;
Double_t GetValue(Int_t i, Int_t len, Bool_t subarr = kFALSE) const;
virtual void *GetValuePointer() const;
Bool_t IsBranchFolder() const {return TestBit(kBranchFolder);}
Bool_t IsFolder() const;
virtual Bool_t Notify() {fAddress = 0; return 1;}
virtual void Print(Option_t *option="") const;
void PrintValue(Int_t i) const;
virtual void ReadLeaves(TBuffer &b);
virtual void Reset(Option_t *option="");
virtual void ResetAddress();
virtual void SetAddress(void *addobj);
virtual void SetAutoDelete(Bool_t autodel=kTRUE);
virtual void SetBasketSize(Int_t buffsize);
virtual void SetBranchCount(TBranchElement *bre);
virtual void SetBranchCount2(TBranchElement *bre) {fBranchCount2 = bre;}
virtual void SetBranchFolder() {SetBit(kBranchFolder);}
virtual void SetClassName(const char *name) {fClassName=name;}
void SetParentClass(TClass *clparent);
virtual void SetParentName(const char *name) {fParentName=name;}
virtual void SetupAddresses();
virtual void SetType(Int_t btype) {fType=btype;}
virtual Int_t Unroll(const char *name, TClass *cltop, TClass *cl,Int_t basketsize, Int_t splitlevel, Int_t btype);
ClassDef(TBranchElement,8) //Branch in case of an object
TBranchElement();
TBranchElement(const char* name, TStreamerInfo* sinfo, Int_t id, char* pointer, Int_t basketsize = 32000, Int_t splitlevel = 0, Int_t btype = 0);
TBranchElement(const char* name, TClonesArray* clones, Int_t basketsize = 32000, Int_t splitlevel = 0, Int_t compress = -1);
TBranchElement(const char* name, TVirtualCollectionProxy* cont, Int_t basketsize = 32000, Int_t splitlevel = 0, Int_t compress = -1);
virtual ~TBranchElement();
virtual void Browse(TBrowser* b);
virtual Int_t Fill();
virtual void FillLeaves(TBuffer& b);
virtual char *GetAddress() const;
TBranchElement *GetBranchCount() const { return fBranchCount; }
TBranchElement *GetBranchCount2() const { return fBranchCount2; }
Int_t *GetBranchOffset() const { return fBranchOffset; }
UInt_t GetCheckSum() { return fCheckSum; }
virtual const char *GetClassName() const { return fClassName.Data(); }
virtual const char *GetClonesName() const { return fClonesName.Data(); }
virtual Int_t GetEntry(Long64_t entry = 0, Int_t getall = 0);
const char *GetIconName() const;
Int_t GetID() const { return fID; }
TStreamerInfo *GetInfo() const;
char *GetObject() const;
virtual const char *GetParentName() const { return fParentName.Data(); }
virtual Int_t GetMaximum() const;
Int_t GetNdata() const { return fNdata; }
Int_t GetType() const { return fType; }
Int_t GetStreamerType() const { return fStreamerType; }
virtual const char *GetTypeName() const;
Double_t GetValue(Int_t i, Int_t len, Bool_t subarr = kFALSE) const;
virtual void *GetValuePointer() const;
Bool_t IsBranchFolder() const { return TestBit(kBranchFolder); }
Bool_t IsFolder() const;
virtual Bool_t IsObjectOwner() const { return TestBit(kDeleteObject); }
virtual Bool_t Notify() { if (fAddress) { SetAddress(0); } return 1; }
virtual void Print(Option_t* option = "") const;
void PrintValue(Int_t i) const;
virtual void ReadLeaves(TBuffer& b);
virtual void Reset(Option_t* option = "");
virtual void ResetAddress();
virtual void ResetDeleteObject();
virtual void SetAddress(void* addobj);
virtual void SetBasketSize(Int_t buffsize);
virtual void SetBranchFolder() { SetBit(kBranchFolder); }
virtual void SetClassName(const char* name) { fClassName = name; }
inline void SetParentClass(TClass* clparent);
virtual void SetParentName(const char* name) { fParentName = name; }
virtual void SetupAddresses();
virtual void SetType(Int_t btype) { fType = btype; }
ClassDef(TBranchElement,8) // Branch in case of an object
};
inline void TBranchElement::SetParentClass(TClass *clparent)
{
fParentClass = clparent;
SetParentName(clparent?clparent->GetName():"");
inline void TBranchElement::SetParentClass(TClass* clparent)
{
fParentClass = clparent;
fParentName = clparent ? clparent->GetName() : "";
}
#endif
#endif // ROOT_TBranchElement
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment