Warning, file /include/root/TMapFile.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TMapFile
0013 #define ROOT_TMapFile
0014
0015 #ifdef WIN32
0016 #include "Windows4Root.h"
0017 #endif
0018
0019 #include "TObject.h"
0020 #include "TVirtualMapFile.h"
0021
0022 class TDirectory;
0023 class TList;
0024 class TMapRec;
0025
0026 class TMapFile : public TVirtualMapFile {
0027
0028 friend class TMapRec;
0029
0030 private:
0031 Longptr_t fFd;
0032 Int_t fVersion;
0033 char *fName;
0034 char *fTitle;
0035 char *fOption;
0036 void *fMmallocDesc;
0037 ULongptr_t fBaseAddr;
0038 Int_t fSize;
0039 TMapRec *fFirst;
0040 TMapRec *fLast;
0041 Longptr_t fOffset;
0042 TDirectory *fDirectory;
0043 TList *fBrowseList;
0044 Bool_t fWritable;
0045 Longptr_t fSemaphore;
0046 ULongptr_t fhSemaphore;
0047 TObject *fGetting;
0048 Int_t fWritten;
0049 Double_t fSumBuffer;
0050 Double_t fSum2Buffer;
0051
0052 static Longptr_t fgMapAddress;
0053 static void *fgMmallocDesc;
0054
0055 protected:
0056 TMapFile();
0057 TMapFile(const char *name, const char *title, Option_t *option, Int_t size, TMapFile *&newMapFile);
0058 TMapFile(const TMapFile &f, Longptr_t offset = 0);
0059
0060 TMapFile &operator=(const TMapFile &rhs) = delete;
0061
0062 TMapFile *FindShadowMapFile();
0063 void InitDirectory();
0064 TObject *Remove(TObject *obj, Bool_t lock);
0065 TObject *Remove(const char *name, Bool_t lock);
0066 void SumBuffer(Int_t bufsize);
0067 Int_t GetBestBuffer();
0068
0069 void CreateSemaphore(Int_t pid = 0);
0070 Int_t AcquireSemaphore();
0071 Int_t ReleaseSemaphore();
0072 void DeleteSemaphore();
0073
0074 static void *MapToAddress();
0075
0076 public:
0077 enum { kDefaultMapSize = 0x80000 };
0078
0079
0080 ~TMapFile() override;
0081 void *operator new(size_t sz) { return TObject::operator new(sz); }
0082 void *operator new[](size_t sz) { return TObject::operator new[](sz); }
0083 void *operator new(size_t sz, void *vp) { return TObject::operator new(sz, vp); }
0084 void *operator new[](size_t sz, void *vp) { return TObject::operator new[](sz, vp); }
0085 void operator delete(void *vp);
0086
0087 void Browse(TBrowser *b) override;
0088 void Close(Option_t *option = "") override;
0089 void *GetBaseAddr() const { return (void *)fBaseAddr; }
0090 void *GetBreakval() const;
0091 TDirectory *GetDirectory() const {return fDirectory;}
0092 Int_t GetFd() const { return fFd; }
0093 void *GetMmallocDesc() const { return fMmallocDesc; }
0094 const char *GetName() const override { return fName; }
0095 Int_t GetSize() const { return fSize; }
0096 const char *GetOption() const override { return fOption; }
0097 const char *GetTitle() const override { return fTitle; }
0098 TMapRec *GetFirst() const { return (TMapRec*)((Longptr_t) fFirst + fOffset); }
0099 TMapRec *GetLast() const { return (TMapRec*)((Longptr_t) fLast + fOffset); }
0100 Bool_t IsFolder() const override;
0101 Bool_t IsWritable() const { return fWritable; }
0102 void *OrgAddress(void *addr) const { return (void *)((Longptr_t)addr - fOffset); }
0103 void Print(Option_t *option="") const override;
0104 void ls(Option_t *option="") const override;
0105 Bool_t cd(const char *path = nullptr);
0106
0107 void Add(const TObject *obj, const char *name = "");
0108 void Update(TObject *obj = nullptr);
0109 TObject *Remove(TObject *obj) { return Remove(obj, kTRUE); }
0110 TObject *Remove(const char *name) { return Remove(name, kTRUE); }
0111 void RemoveAll();
0112 TObject *Get(const char *name, TObject *retObj = nullptr);
0113
0114 static TMapFile *Create(const char *name, Option_t *option="READ", Int_t size=kDefaultMapSize, const char *title="");
0115 static TMapFile *WhichMapFile(void *addr);
0116 static void SetMapAddress(Longptr_t addr);
0117
0118 ClassDefOverride(TMapFile,0)
0119 };
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 class TMapRec {
0134
0135 friend class TMapFile;
0136
0137 private:
0138 char *fName;
0139 char *fClassName;
0140 TObject *fObject;
0141 void *fBuffer;
0142 Int_t fBufSize;
0143 TMapRec *fNext;
0144
0145 TMapRec(const TMapRec&) = delete;
0146 TMapRec &operator=(const TMapRec&) = delete;
0147
0148 public:
0149 TMapRec(const char *name, const TObject *obj, Int_t size, void *buf);
0150 ~TMapRec();
0151 const char *GetName(Longptr_t offset = 0) const { return (char *)((Longptr_t) fName + offset); }
0152 const char *GetClassName(Longptr_t offset = 0) const { return (char *)((Longptr_t) fClassName + offset); }
0153 void *GetBuffer(Longptr_t offset = 0) const { return (void *)((Longptr_t) fBuffer + offset); }
0154 Int_t GetBufSize() const { return fBufSize; }
0155 TObject *GetObject() const;
0156 TMapRec *GetNext(Longptr_t offset = 0) const { return (TMapRec *)((Longptr_t) fNext + offset); }
0157 };
0158
0159 #endif