#ifndef ROOT_TMapFile
#define ROOT_TMapFile
#ifdef WIN32
#include "Windows4Root.h"
#endif
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TROOT
#include "TROOT.h"
#endif
#if !defined(__MMPRIVATE_H) && !defined(__CINT__)
#include "mmprivate.h"
#endif
class TBrowser;
class TDirectory;
class TList;
class TMapRec;
class TMapFile : public TObject {
friend class TMapRec;
private:
Int_t fFd;
Int_t fVersion;
char *fName;
char *fTitle;
char *fOption;
void *fMmallocDesc;
ULong_t fBaseAddr;
Int_t fSize;
TMapRec *fFirst;
TMapRec *fLast;
Long_t fOffset;
TDirectory *fDirectory;
TList *fBrowseList;
Bool_t fWritable;
Int_t fSemaphore;
ULong_t fhSemaphore;
TObject *fGetting;
Int_t fWritten;
Double_t fSumBuffer;
Double_t fSum2Buffer;
static Long_t fgMapAddress;
static void *fgMmallocDesc;
protected:
TMapFile();
TMapFile(const char *name, const char *title, Option_t *option, Int_t size, TMapFile *&newMapFile);
TMapFile(const TMapFile &f, Long_t offset = 0);
void operator=(const TMapFile &rhs);
TMapFile *FindShadowMapFile();
void InitDirectory();
TObject *Remove(TObject *obj, Bool_t lock);
TObject *Remove(const char *name, Bool_t lock);
void SumBuffer(Int_t bufsize);
Int_t GetBestBuffer();
void CreateSemaphore(Int_t pid=0);
Int_t AcquireSemaphore();
Int_t ReleaseSemaphore();
void DeleteSemaphore();
static void *MapToAddress();
public:
enum { kDefaultMapSize = 0x80000 };
virtual ~TMapFile();
void operator delete(void *vp);
void Browse(TBrowser *b);
void Close(Option_t *option = "");
void *GetBaseAddr() const { return (void *)fBaseAddr; }
void *GetBreakval() const;
TDirectory *GetDirectory() const {return fDirectory;}
Int_t GetFd() const { return fFd; }
void *GetMmallocDesc() const { return fMmallocDesc; }
const char *GetName() const { return fName; }
Int_t GetSize() const { return fSize; }
const char *GetOption() const { return fOption; }
const char *GetTitle() const { return fTitle; }
TMapRec *GetFirst() const { return (TMapRec*)((Long_t) fFirst + fOffset); }
TMapRec *GetLast() const { return (TMapRec*)((Long_t) fLast + fOffset); }
Bool_t IsFolder() const;
Bool_t IsWritable() const { return fWritable; }
void *OrgAddress(void *addr) const { return (void *)((Long_t)addr - fOffset); }
void Print(Option_t *option="") const;
void ls(Option_t *option="") const;
Bool_t cd(const char *path = 0);
void Add(const TObject *obj, const char *name = "");
void Update(TObject *obj = 0);
TObject *Remove(TObject *obj) { return Remove(obj, kTRUE); }
TObject *Remove(const char *name) { return Remove(name, kTRUE); }
void RemoveAll();
TObject *Get(const char *name, TObject *retObj = 0);
static TMapFile *Create(const char *name, Option_t *option="READ", Int_t size=kDefaultMapSize, const char *title="");
static TMapFile *WhichMapFile(void *addr);
static void SetMapAddress(Long_t addr);
ClassDef(TMapFile,0)
};
class TMapRec {
friend class TMapFile;
private:
char *fName;
char *fClassName;
TObject *fObject;
void *fBuffer;
Int_t fBufSize;
TMapRec *fNext;
public:
TMapRec(const char *name, const TObject *obj, Int_t size, void *buf);
~TMapRec();
const char *GetName(Long_t offset = 0) const { return (char *)((Long_t) fName + offset); }
const char *GetClassName(Long_t offset = 0) const { return (char *)((Long_t) fClassName + offset); }
void *GetBuffer(Long_t offset = 0) const { return (void *)((Long_t) fBuffer + offset); }
Int_t GetBufSize() const { return fBufSize; }
TObject *GetObject() const;
TMapRec *GetNext(Long_t offset = 0) const { return (TMapRec *)((Long_t) fNext + offset); }
};
inline void *TMapFile::GetBreakval() const
{
if (!fMmallocDesc) return 0;
return (void *)((struct mdesc *)fMmallocDesc)->breakval;
}
inline TMapFile *TMapFile::WhichMapFile(void *addr)
{
if (!gROOT || !gROOT->GetListOfMappedFiles()) return 0;
TObjLink *lnk = ((TList *)gROOT->GetListOfMappedFiles())->LastLink();
while (lnk) {
TMapFile *mf = (TMapFile*)lnk->GetObject();
if (!mf) return 0;
if ((ULong_t)addr >= mf->fBaseAddr + mf->fOffset &&
(ULong_t)addr < (ULong_t)mf->GetBreakval() + mf->fOffset)
return mf;
lnk = lnk->Prev();
}
return 0;
}
R__EXTERN void *gMmallocDesc;
#endif
Last change: Wed Jun 25 08:49:01 2008
Last generated: 2008-06-25 08:49
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.