|
ROOT
Reference Guide |
|
Go to the documentation of this file.
207 void Delete(
const char *namecycle=
"")
override;
211 virtual void Flush();
256 virtual void MakeProject(
const char *dirname,
const char *classes=
"*",
332 UInt_t buffersize = 1000000);
343 #define gFile (TFile::CurrentFile())
345 #elif defined(__MAKECINT__)
Long64_t fBEGIN
First used byte in file.
virtual void DirWriteHeader(TDirectory *)
Int_t fNProcessIDs
Number of TProcessID written to this file.
Long64_t fBytesWrite
Number of bytes written to this file.
virtual Bool_t ReadBufferAsync(Long64_t offs, Int_t len)
Int_t fVersion
File format version.
Class describing an archive file containing multiple sub-files, like a ZIP or TAR archive.
static std::atomic< Long64_t > fgBytesRead
Number of bytes read by all TFile objects.
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode.
Int_t fCompress
Compression level and algorithm.
void operator=(const TFile &)=delete
virtual void ReadFree()
Read the FREE linked list.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
EOpenTimeOut
Open timeout constants.
virtual void SetCompressionAlgorithm(Int_t algorithm=ROOT::RCompressionSetting::EAlgorithm::kUseGlobal)
See comments for function SetCompressionSettings.
Char_t fUnits
Number of bytes for file pointers.
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression)
static TFile * OpenFromCache(const char *name, Option_t *="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Open a file for reading through the file cache.
Long64_t fSeekFree
Location on disk of free segments structure.
void FillBuffer(char *&buffer) override
Encode file output buffer.
Int_t fReadCalls
Number of read calls ( not counting the cache calls )
ROOT::Internal::RConcurrentHashColl::HashValue fHash
TObjArray * fProcessIDs
!Array of pointers to TProcessIDs
virtual void Seek(Long64_t offset, ERelativeTo pos=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
@ kUseCompiledDefault
Use the compile-time default setting.
Long64_t fBytesRead
Number of bytes read from this file.
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
TFile(const TFile &)=delete
virtual TProcessID * ReadProcessID(UShort_t pidf)
The TProcessID with number pidf is read from this file.
static Bool_t fgReadInfo
if true (default) ReadStreamerInfo is called when opening a file
virtual Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
Int_t GetBestBuffer() const
Return the best buffer size of objects on this file.
const char * Data() const
virtual void SetCompressionLevel(Int_t level=ROOT::RCompressionSetting::ELevel::kUseMin)
See comments for function SetCompressionSettings.
ECacheAction
TTreeCache flushing semantics.
static void SetFileBytesWritten(Long64_t bytes=0)
TArchiveFile * GetArchive() const
static void IncrementFileCounter()
virtual Long64_t GetSeekFree() const
Long64_t GetRelOffset() const
TArrayC * fClassIndex
!Index of TStreamerInfo classes written to this file
Int_t GetCompress() const
Bool_t fIsArchive
!True if this is a pure archive file
Bool_t fIsPcmFile
!True if the file is a ROOT pcm file.
TMap * fCacheReadMap
!Pointer to the read cache (if any)
virtual void ResetErrno() const
Method resetting the errno.
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
Creates key for object and converts data to buffer.
basic_string_view< char > string_view
TFileOpenHandle(const TFileOpenHandle &)=delete
static UInt_t fgOpenTimeout
Timeout for open operations in ms - 0 corresponds to blocking i/o.
Long64_t fSeekInfo
Location on disk of StreamerInfo record.
virtual Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Return file stat information.
TArrayC * GetClassIndex() const
TString fRealName
Effective real file name (not original url)
static void SetFileReadCalls(Int_t readcalls=0)
static Long64_t GetFileBytesRead()
Static function returning the total number of bytes read from all files.
A TProcessID identifies a ROOT job in a unique way in time and space.
void Paint(Option_t *option="") override
Paint all objects in the file.
virtual void SetReadCalls(Int_t readcalls=0)
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
TFileOpenHandle(TFile *f)
Long64_t GetArchiveOffset() const
virtual Long64_t GetBytesWritten() const
Return the total number of bytes written so far to the file.
Double_t fSumBuffer
Sum of buffer sizes of objects written so far.
virtual Long64_t GetSeekInfo() const
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
virtual Int_t GetErrno() const
Method returning errno.
static TList * fgAsyncOpenRequests
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Long64_t fBytesReadExtra
Number of extra bytes (overhead) read by the readahead buffer.
virtual void SetEND(Long64_t last)
static Bool_t GetReadStreamerInfo()
If the streamerinfos are to be read at file opening.
void Draw(Option_t *option="") override
Fill Graphics Structure and Paint.
static void SetReadStreamerInfo(Bool_t readinfo=kTRUE)
Specify if the streamerinfos must be read at file opening.
virtual void MakeProject(const char *dirname, const char *classes="*", Option_t *option="new")
Generate source code necessary to access the objects stored in the file.
Class holding info about the file being opened.
Bool_t Matches(const char *name)
Return kTRUE if this async request matches the open request specified by 'url'.
This class is a TS set of unsigned set.
TObjArray * GetListOfProcessIDs() const
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
#define ClassDefOverride(name, id)
virtual Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close().
static UInt_t GetOpenTimeout()
Returns open timeout (in ms).
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) override
Write memory objects to this file.
static Bool_t ShrinkCacheFileDir(Long64_t shrinkSize, Long_t cleanupInteval=0)
Try to shrink the cache to the desired size.
virtual Int_t GetNfree() const
Int_t WriteBufferViaCache(const char *buf, Int_t len)
Write buffer via cache.
virtual void WriteStreamerInfo()
Write the list of TStreamerInfo as a single object in this file The class Streamer description for al...
virtual TList * GetStreamerInfoList() final
Read the list of TStreamerInfo objects written to this file.
TList * fInfoCache
!Cached list of the streamer infos in this file
virtual Int_t GetBytesToPrefetch() const
Max number of bytes to prefetch.
virtual Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write().
TArchiveFile * fArchive
!Archive file from which we read this file
static EFileType GetType(const char *name, Option_t *option="", TString *prefix=nullptr)
Resolve the file type as a function of the protocol field in 'name'.
virtual Long64_t DirCreateEntry(TDirectory *)
static void SetReadaheadSize(Int_t bufsize=256000)
Int_t GetCompressionAlgorithm() const
TFileOpenHandle & operator=(const TFileOpenHandle &)=delete
virtual Bool_t IsArchive() const
void SumBuffer(Int_t bufsize)
Increment statistics for buffer sizes of objects in this file.
static void CpProgress(Long64_t bytesread, Long64_t size, TStopwatch &watch)
Print file copy progress.
Simple struct of the return value of GetStreamerInfoListImpl.
Int_t fNbytesInfo
Number of bytes for StreamerInfo record.
virtual void Init(Bool_t create)
Initialize a TFile object.
virtual TString GetNewUrl()
virtual Long64_t GetBytesRead() const
virtual void WriteFree()
Write FREE linked list on the file.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
std::mutex fWriteMutex
!Lock for writing baskets / keys into the file.
virtual Int_t SysSync(Int_t fd)
Interface to system fsync. All arguments like in POSIX fsync().
virtual Int_t GetNbytesFree() const
TFile()
File default Constructor.
Int_t GetRecordHeader(char *buf, Long64_t first, Int_t maxbytes, Int_t &nbytes, Int_t &objlen, Int_t &keylen)
Read the logical record header starting at a certain postion.
The TNamed class is the base class for all named ROOT classes.
Option_t * GetOption() const override
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
static Long64_t GetFileBytesWritten()
Static function returning the total number of bytes written to all files.
virtual void ShowStreamerInfo()
Show the StreamerInfo of all classes written to this file.
virtual Int_t GetReadCalls() const
virtual Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read().
static Int_t GetReadaheadSize()
Static function returning the readahead buffer size.
static Int_t GetFileReadCalls()
Static function returning the total number of read calls from all files.
virtual Long64_t GetSize() const
Returns the current file size.
void ls(Option_t *option="") const override
List file contents.
virtual Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open().
static TFile *& CurrentFile()
Return the current ROOT file if any.
Float_t GetCompressionFactor()
Return the file compression factor.
static Bool_t GetOnlyStaged()
Returns staged only flag.
void Delete(const char *namecycle="") override
Delete object namecycle.
virtual InfoListRet GetStreamerInfoListImpl(bool lookupSICache)
See documentation of GetStreamerInfoList for more details.
Double_t fSum2Buffer
Sum of squares of buffer sizes of objects written so far.
virtual void IncrementProcessIDs()
static ROOT::Internal::RConcurrentHashColl fgTsSIHashes
!TS Set of hashes built from read streamer infos
@ kUseGlobal
Use the global compression algorithm.
virtual void MakeFree(Long64_t first, Long64_t last)
Mark unused bytes on the file.
This class represents a WWW compatible URL.
static TString fgCacheFileDir
Directory where to locally stage files.
static TFileOpenHandle * AsyncOpen(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Submit an asynchronous open request.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A cache when reading files over the network.
void Print(Option_t *option="") const override
Print all objects in the file.
Int_t MakeProjectParProofInf(const char *packname, const char *proofinfdir)
Create BUILD.sh and SETUP.C under 'proofinf' for PAR package 'pack'.
Array of chars or bytes (8 bits per element).
static Bool_t fgCacheFileDisconnected
Indicates, we trust in the files in the cache dir without stat on the cached file.
The prefetching mechanism uses two classes (TFilePrefetch and TFPBlock) to prefetch in advance a bloc...
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual Bool_t ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf)
Read the nbuf blocks described in arrays pos and len.
Long64_t fEND
Last used byte in file.
Int_t fCompress
Compression level and algorithm.
virtual Int_t GetNProcessIDs() const
Int_t fNetOpt
Network options.
Int_t ReadBufferViaCache(char *buf, Int_t len)
Read buffer via cache.
TString fOption
File options.
virtual void SetOption(Option_t *option=">")
static Bool_t fgOnlyStaged
Before the file is opened, it is checked, that the file is staged, if not, the open fails.
Manages buffers for branches of a Tree.
virtual void ReadStreamerInfo()
Read the list of StreamerInfo from this file.
const char * GetOpt() const
virtual Bool_t MustFlush() const
void Copy(TObject &) const override
Copy this to obj.
EAsyncOpenStatus fAsyncOpenStatus
!Status of an asynchronous open request
const TList * GetStreamerInfoCache()
Returns the cached list of StreamerInfos used in this file.
static Bool_t SetOnlyStaged(Bool_t onlystaged)
Sets only staged flag.
Bool_t FlushWriteCache()
Flush the write cache if active.
static std::atomic< Long64_t > fgFileCounter
Counter for all opened files.
static std::atomic< Long64_t > fgBytesWrite
Number of bytes written by all TFile objects.
virtual Int_t DirReadKeys(TDirectory *)
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
static std::atomic< Int_t > fgReadCalls
Number of bytes read from all TFile objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t fNoAnchorInName
!True if we don't want to force the anchor to be appended to the file name
Mother of all ROOT objects.
virtual UShort_t WriteProcessID(TProcessID *pid)
Check if the ProcessID pidd is already in the file, if not, add it and return the index number in the...
static Long64_t GetFileCounter()
void Close(Option_t *option="") override
Close a file.
virtual void SetCacheWrite(TFileCacheWrite *cache)
Set a pointer to the write cache.
Int_t GetCompressionLevel() const
Bool_t fMustFlush
!True if the file buffers must be flushed
static const char * GetCacheFileDir()
Get the directory where to locally stage/cache remote files.
A cache when writing files over the network.
Int_t GetCompressionSettings() const
Int_t MakeProjectParMake(const char *packname, const char *filename)
Create makefile at 'filemake' for PAR package 'pack'.
Describe directory structure in memory.
Long64_t fArchiveOffset
!Offset at which file starts in archive
Bool_t fIsRootFile
!True is this is a ROOT file, raw file otherwise
TList * fFree
Free segments linked list table.
virtual Int_t GetNbytesInfo() const
virtual Long64_t GetEND() const
static Int_t fgReadaheadSize
Readahead buffer size.
virtual void DirWriteKeys(TDirectory *)
virtual void WriteHeader()
Write File Header.
Int_t fNbytesFree
Number of bytes for free segments structure.
static Bool_t fgCacheFileForce
Indicates, to force all READ to CACHEREAD.
virtual ~TFile()
File destructor.
TFileOpenHandle(const char *n, const char *o, const char *t, Int_t cmp, Int_t no)
virtual Int_t Recover()
Attempt to recover file if not correctly closed.
TFileCacheWrite * GetCacheWrite() const
Return a pointer to the current write cache.
TList * GetListOfFree() const
TList * fOpenPhases
!Time info about open phases
A ROOT file is structured in Directories (like a file system).
static UInt_t SetOpenTimeout(UInt_t timeout)
Sets open timeout time (in ms). Returns previous timeout value.
virtual Long64_t GetBytesReadExtra() const
EAsyncOpenStatus
Asynchronous open request status.
TFile * fFile
TFile instance of the file being opened.
TFileCacheWrite * fCacheWrite
!Pointer to the write cache (if any)
Int_t Sizeof() const override
Return the size in bytes of the file header.
virtual Bool_t Matches(const char *name)
Return kTRUE if 'url' matches the coordinates of this file.
virtual EAsyncOpenStatus GetAsyncOpenStatus()
Int_t fWritten
Number of objects written so far.
Long64_t fOffset
!Seek offset cache
Bool_t fInitDone
!True if the file has been initialized
virtual const TUrl * GetEndpointUrl() const
TFileOpenHandle * fAsyncHandle
!For proper automatic cleanup
TFileCacheRead * GetCacheRead(const TObject *tree=nullptr) const
Return a pointer to the current read cache.
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
static void SetFileBytesRead(Long64_t bytes=0)
virtual void SetCacheRead(TFileCacheRead *cache, TObject *tree=0, ECacheAction action=kDisconnect)
Set a pointer to the read cache.
virtual void SetOffset(Long64_t offset, ERelativeTo pos=kBeg)
Set position from where to start reading.
virtual void DrawMap(const char *keys="*", Option_t *option="")
Draw map of objects in this file.
TFileCacheRead * fCacheRead
!Pointer to the read cache (if any)
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
virtual void SetCompressionSettings(Int_t settings=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault)
Used to specify the compression level and algorithm.