Logo ROOT   6.12/07
Reference Guide
TGFALFile.h
Go to the documentation of this file.
1 // @(#)root/gfal:$Id$
2 // Author: Fons Rademakers 8/12/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGFALFile
13 #define ROOT_TGFALFile
14 
15 #include "TFile.h"
16 #include "TSystem.h"
17 
18 
19 class TGFALFile : public TFile {
20 
21 private:
22  Bool_t fStatCached; ///<! (transient) is file status cached?
23  struct stat64 fStatBuffer; ///<! (transient) Cached file status buffer (for performance)
24 
25  TGFALFile() : fStatCached(kFALSE) { }
26 
27  // Interface to basic system I/O routines
28  Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode);
29  Int_t SysClose(Int_t fd);
30  Int_t SysRead(Int_t fd, void *buf, Int_t len);
31  Int_t SysWrite(Int_t fd, const void *buf, Int_t len);
32  Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence);
33  Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
34  Int_t SysSync(Int_t) { /* no fsync for GFAL */ return 0; }
35 
36 public:
37  TGFALFile(const char *url, Option_t *option="",
38  const char *ftitle="", Int_t compress=1);
39  ~TGFALFile();
40 
41  Bool_t ReadBuffer(char *buf, Int_t len);
42  Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
43  Bool_t WriteBuffer(const char *buf, Int_t len);
44 
45  ClassDef(TGFALFile,1) //A ROOT file that reads/writes via a GFAL
46 };
47 
48 
49 class TGFALSystem : public TSystem {
50 
51 private:
52  void *fDirp; // directory handler
53 
54  void *GetDirPtr() const { return fDirp; }
55 
56 public:
57  TGFALSystem();
58  virtual ~TGFALSystem() { }
59 
60  Int_t MakeDirectory(const char *name);
61  void *OpenDirectory(const char *name);
62  void FreeDirectory(void *dirp);
63  const char *GetDirEntry(void *dirp);
64  Int_t GetPathInfo(const char *path, FileStat_t &buf);
65  Bool_t AccessPathName(const char *path, EAccessMode mode);
66 
67  ClassDef(TGFALSystem,0) // Directory handler for GFAL
68 };
69 
70 #endif
struct stat64 fStatBuffer
! (transient) Cached file status buffer (for performance)
Definition: TGFALFile.h:23
long long Long64_t
Definition: RtypesCore.h:69
Int_t SysClose(Int_t fd)
Interface to system close. All arguments like in POSIX close.
Definition: TGFALFile.cxx:204
const char Option_t
Definition: RtypesCore.h:62
Int_t SysRead(Int_t fd, void *buf, Int_t len)
Interface to system read. All arguments like in POSIX read.
Definition: TGFALFile.cxx:214
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
Definition: TGFALFile.cxx:236
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via GFAL.
Definition: TGFALFile.cxx:320
void * GetDirPtr() const
Definition: TGFALFile.h:54
Int_t SysSync(Int_t)
Interface to system fsync. All arguments like in POSIX fsync().
Definition: TGFALFile.h:34
#define ClassDef(name, id)
Definition: Rtypes.h:320
Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime)
Interface to TSystem:GetPathInfo().
Definition: TGFALFile.cxx:247
Bool_t fStatCached
! (transient) is file status cached?
Definition: TGFALFile.h:22
TGFALFile()
Definition: TGFALFile.h:25
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via GFAL.
Definition: TGFALFile.cxx:287
Read and write data via the underlying Grid access mechanism.
Definition: TGFALFile.h:19
void * fDirp
Definition: TGFALFile.h:52
virtual ~TGFALSystem()
Definition: TGFALFile.h:58
unsigned int UInt_t
Definition: RtypesCore.h:42
~TGFALFile()
GFAL file dtor. Close and flush directory structure.
Definition: TGFALFile.cxx:186
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
EAccessMode
Definition: TSystem.h:44
Directory handler for GFAL.
Definition: TGFALFile.h:49
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:248
char name[80]
Definition: TGX11.cxx:109
Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode)
Interface to system open. All arguments like in POSIX open.
Definition: TGFALFile.cxx:194
Int_t SysWrite(Int_t fd, const void *buf, Int_t len)
Interface to system write. All arguments like in POSIX write.
Definition: TGFALFile.cxx:224