Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TRefTable.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/cont:$Id$
0002 // Author: Rene Brun   17/08/2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TRefTable
0013 #define ROOT_TRefTable
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TRefTable                                                            //
0019 //                                                                      //
0020 // A TRefTable maintains the association between a referenced object    //
0021 // and the parent object supporting this referenced object.             //
0022 // The parent object is typically a branch of a TTree.                  //
0023 //                                                                      //
0024 //////////////////////////////////////////////////////////////////////////
0025 
0026 
0027 #include "TObject.h"
0028 
0029 #include <string>
0030 #include <vector>
0031 
0032 class TObjArray;
0033 class TProcessID;
0034 
0035 class TRefTable : public TObject {
0036 
0037 protected:
0038    Int_t             fNumPIDs;    //!number of known ProcessIDs
0039    Int_t            *fAllocSize;  //![fNumPIDs] allocated size of array fParentIDs for each ProcessID
0040    Int_t            *fN;          //![fNumPIDs] current maximum number of IDs in array fParentIDs for each ProcessID
0041    Int_t           **fParentIDs;  //![fNumPIDs][fAllocSize] array of Parent IDs
0042    Int_t             fParentID;   //!current parent ID in fParents (latest call to SetParent)
0043    Int_t             fDefaultSize;//!default size for a new PID array
0044    UInt_t            fUID;        //!Current uid (set by TRef::GetObject)
0045    TProcessID       *fUIDContext; //!TProcessID the current uid is referring to
0046    Int_t             fSize;       //dummy for backward compatibility
0047    TObjArray        *fParents;    //array of Parent objects  (eg TTree branch) holding the referenced objects
0048    TObject          *fOwner;      //Object owning this TRefTable
0049    std::vector<std::string> fProcessGUIDs; // UUIDs of TProcessIDs used in fParentIDs
0050    std::vector<Int_t> fMapPIDtoInternal;   //! cache of pid to index in fProcessGUIDs
0051    static TRefTable *fgRefTable;  //Pointer to current TRefTable
0052 
0053    Int_t              AddInternalIdxForPID(TProcessID* procid);
0054    virtual Int_t      ExpandForIID(Int_t iid, Int_t newsize);
0055    void               ExpandPIDs(Int_t numpids);
0056    Int_t              FindPIDGUID(const char* guid) const;
0057    Int_t              GetInternalIdxForPID(TProcessID* procid) const;
0058    Int_t              GetInternalIdxForPID(Int_t pid) const;
0059 
0060 public:
0061 
0062    enum EStatusBits {
0063       kHaveWarnedReadingOld = BIT(14)
0064    };
0065 
0066    TRefTable();
0067    TRefTable(TObject *owner, Int_t size);
0068    virtual ~TRefTable();
0069 
0070    TRefTable(const TRefTable&) = delete;
0071    TRefTable &operator=(const TRefTable&) = delete;
0072 
0073    virtual Int_t      Add(Int_t uid, TProcessID* context = nullptr);
0074    void               Clear(Option_t * /*option*/ ="") override;
0075    virtual Int_t      Expand(Int_t pid, Int_t newsize);
0076    virtual void       FillBuffer(TBuffer &b);
0077    static TRefTable  *GetRefTable();
0078    Int_t              GetNumPIDs() const {return fNumPIDs;}
0079    Int_t              GetSize(Int_t pid) const {return fAllocSize[GetInternalIdxForPID(pid)];}
0080    Int_t              GetN(Int_t pid) const {return fN[GetInternalIdxForPID(pid)];}
0081    TObject           *GetOwner() const {return fOwner;}
0082    TObject           *GetParent(Int_t uid, TProcessID *context = nullptr) const;
0083    TObjArray         *GetParents() const {return fParents;}
0084    UInt_t             GetUID() const {return fUID;}
0085    TProcessID        *GetUIDContext() const {return fUIDContext;}
0086    Bool_t             Notify() override;
0087    virtual void       ReadBuffer(TBuffer &b);
0088    virtual void       Reset(Option_t * /* option */ ="");
0089    virtual Int_t      SetParent(const TObject* parent, Int_t branchID);
0090    static  void       SetRefTable(TRefTable *table);
0091    virtual void       SetUID(UInt_t uid, TProcessID *context = nullptr) { fUID = uid; fUIDContext = context; }
0092 
0093    ClassDefOverride(TRefTable,3)  //Table of referenced objects during an I/O operation
0094 };
0095 
0096 #endif