ROOT logo
ROOT » CORE » CONT » TRefTable

class TRefTable: public TObject


A TRefTable maintains the association between a referenced object
and the parent object supporting this referenced object.

The parent object is typically a branch of a TTree. For each object
referenced in a TTree entry, the corresponding entry in the TTree's
TBranchRef::fRefTable contains the index of the branch that
needs to be loaded to bring the object into memory.

Persistency of a TRefTable is split into two parts:
* entry specific information is stored (read) by FillBuffer
(ReadBuffer). For each referenced object the object's fUniqueID
and the referencing TRef::fPID is stored (to allow the TRefTable
to autoload references created by different processes).
* non-entry specific, i.e. global information is stored (read) by
the Streamer function. This comprises all members marked as
persistent.

As TObject::fUniqueID is only unique for a given TProcessID, a table
of unique IDs is kept for each used TProcessID. There is no natural
order of TProcessIDs, so TRefTable stores a vector of the TGUID of
all known TProcessIDs in fProcessGUIDs; the index of a TProcessID in
this vector defines the index of the auto-loading info in fParentIDs
for that TProcessID. The mapping of TProcessID* to index is cached
for quick non-persistent lookup.


Function Members (Methods)

public:
TRefTable()
TRefTable(const TRefTable&)
TRefTable(TObject* owner, Int_t size)
virtual~TRefTable()
voidTObject::AbstractMethod(const char* method) const
virtual Int_tAdd(Int_t uid, TProcessID* context = 0)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual Int_tExpand(Int_t pid, Int_t newsize)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidFillBuffer(TBuffer& b)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Int_tGetN(Int_t pid) const
virtual const char*TObject::GetName() const
Int_tGetNumPIDs() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TObject*GetOwner() const
TObject*GetParent(Int_t uid, TProcessID* context = 0) const
TObjArray*GetParents() const
static TRefTable*GetRefTable()
Int_tGetSize(Int_t pid) const
virtual const char*TObject::GetTitle() const
UInt_tGetUID() const
TProcessID*GetUIDContext() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tNotify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TRefTable&operator=(const TRefTable&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidReadBuffer(TBuffer& b)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual voidReset(Option_t* = "")
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual Int_tSetParent(const TObject* parent, Int_t branchID)
static voidSetRefTable(TRefTable* table)
virtual voidSetUID(UInt_t uid, TProcessID* context = 0)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
Int_tAddInternalIdxForPID(TProcessID* procid)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual Int_tExpandForIID(Int_t iid, Int_t newsize)
voidExpandPIDs(Int_t numpids)
Int_tFindPIDGUID(const char* guid) const
Int_tGetInternalIdxForPID(TProcessID* procid) const
Int_tGetInternalIdxForPID(Int_t pid) const
voidTObject::MakeZombie()

Data Members

public:
enum { kHaveWarnedReadingOld
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
Int_t*fAllocSize![fNumPIDs] allocated size of array fParentIDs for each ProcessID
Int_tfDefaultSize!default size for a new PID array
vector<Int_t>fMapPIDtoInternal! cache of pid to index in fProcessGUIDs
Int_t*fN![fNumPIDs] current maximum number of IDs in array fParentIDs for each ProcessID
Int_tfNumPIDs!number of known ProcessIDs
TObject*fOwnerObject owning this TRefTable
Int_tfParentID!current parent ID in fParents (latest call to SetParent)
Int_t**fParentIDs![fNumPIDs][fAllocSize] array of Parent IDs
TObjArray*fParentsarray of Parent objects (eg TTree branch) holding the referenced objects
vector<std::string>fProcessGUIDsUUIDs of TProcessIDs used in fParentIDs
Int_tfSizedummy for backward compatibility
UInt_tfUID!Current uid (set by TRef::GetObject)
TProcessID*fUIDContext!TProcessID the current uid is referring to
static TRefTable*fgRefTablePointer to current TRefTable

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TRefTable()
 Default constructor for I/O.
TRefTable(TObject* owner, Int_t size)
 Create a TRefTable with initial size.
~TRefTable()
 Destructor.
Int_t Add(Int_t uid, TProcessID* context = 0)
 Add a new uid to the table.
 we add a new pair (uid,fparent) to the map
 This function is called by TObject::Streamer or TStreamerInfo::WriteBuffer
Int_t AddInternalIdxForPID(TProcessID* procid)
 Add the internal index for fProcessIDs, fAllocSize, etc given a PID.
void Clear(Option_t* = "")
 Clear all entries in the table.
Int_t Expand(Int_t pid, Int_t newsize)
 Expand fParentIDs to newsize for ProcessID pid.
Int_t ExpandForIID(Int_t iid, Int_t newsize)
 Expand fParentIDs to newsize for internel ProcessID index iid.
void ExpandPIDs(Int_t numpids)
 Expand the arrays of managed PIDs
void FillBuffer(TBuffer& b)
 Fill buffer b with the fN elements in fParentdIDs.
 This function is called by TBranchRef::FillLeaves.
Int_t FindPIDGUID(const char* guid) const
 Get fProcessGUIDs' index of the TProcessID with GUID guid
TObject * GetParent(Int_t uid, TProcessID* context = 0) const
 Return object corresponding to uid.
Int_t GetInternalIdxForPID(TProcessID* procid) const
 Get the index for fProcessIDs, fAllocSize, etc given a PID.
 Uses fMapPIDtoInternal and the pid's GUID / fProcessGUID
Int_t GetInternalIdxForPID(Int_t pid) const
 Get the index for fProcessIDs, fAllocSize, etc given a PID.
 Uses fMapPIDtoInternal and the pid's GUID / fProcessGUID
TRefTable * GetRefTable()
 Static function returning the current TRefTable.
Bool_t Notify()
 This function is called by TRef::Streamer or TStreamerInfo::ReadBuffer
 when reading a reference.
 This function, in turns, notifies the TRefTable owner for action.
 eg, when the owner is a TBranchRef, TBranchRef::Notify is called
 to read the branch containing the referenced object.
void ReadBuffer(TBuffer& b)
 Fill buffer b with the fN elements in fParentdIDs.
 This function is called by TBranchRef::ReadLeaves
void Reset(Option_t* = "")
 Clear all entries in the table.
Int_t SetParent(const TObject* parent, Int_t branchID)
 -- Set current parent object, typically a branch of a tree.

 This function is called by TBranchElement::Fill() and by
 TBranchElement::GetEntry().

void SetRefTable(TRefTable* table)
 Static function setting the current TRefTable.
void Streamer(TBuffer& b)
 Stream an object of class TRefTable.
TRefTable()
Int_t GetNumPIDs() const
{return fNumPIDs;}
Int_t GetSize(Int_t pid) const
Int_t GetN(Int_t pid) const
{return fN[GetInternalIdxForPID(pid)];}
TObject * GetOwner() const
{return fOwner;}
TObjArray * GetParents() const
{return fParents;}
UInt_t GetUID() const
{return fUID;}
TProcessID * GetUIDContext() const
{return fUIDContext;}
void SetUID(UInt_t uid, TProcessID* context = 0)
{fUID=uid; fUIDContext = context;}