File indexing completed on 2025-01-18 10:12:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TObjectTable
0013 #define ROOT_TObjectTable
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "TObject.h"
0031
0032 class TClass;
0033
0034
0035 class TObjectTable : public TObject {
0036
0037 private:
0038 TObject **fTable;
0039 Int_t fSize;
0040 Int_t fTally;
0041
0042 Bool_t HighWaterMark();
0043 void Expand(Int_t newsize);
0044 Int_t FindElement(TObject *obj);
0045 void FixCollisions(Int_t index);
0046
0047 private:
0048 TObjectTable(const TObjectTable&) = delete;
0049 TObjectTable& operator=(const TObjectTable&) = delete;
0050
0051 public:
0052 TObjectTable(Int_t tableSize = 100);
0053 ~TObjectTable();
0054
0055 void Add(TObject *obj);
0056 void *CheckPtrAndWarn(const char *msg, void *vp);
0057 void Delete(Option_t *opt = "") override;
0058 Int_t GetSize() const { return fSize; }
0059 Int_t Instances() const { return fTally; }
0060 void InstanceStatistics() const;
0061 void Print(Option_t *option="") const override;
0062 Bool_t PtrIsValid(TObject *obj);
0063 void Remove(TObject *obj);
0064 void RemoveQuietly(TObject *obj);
0065 void Statistics() { Print(); }
0066 void Terminate();
0067 void UpdateInstCount() const;
0068
0069 static void AddObj(TObject *obj);
0070
0071 ClassDefOverride(TObjectTable,0)
0072 };
0073
0074
0075 inline Bool_t TObjectTable::HighWaterMark()
0076 { return (Bool_t) (fTally >= ((3*fSize)/4)); }
0077
0078 inline Bool_t TObjectTable::PtrIsValid(TObject *op)
0079 { return fTable[FindElement(op)] != nullptr; }
0080
0081
0082 R__EXTERN TObjectTable *gObjectTable;
0083
0084 #endif