ROOT  6.06/09
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 #ifndef ROOT_TFile
16 #include "TFile.h"
17 #endif
18 #ifndef ROOT_TSystem
19 #include "TSystem.h"
20 #endif
21 
22 
23 class TGFALFile : public TFile {
24 
25 private:
26  Bool_t fStatCached; ///<! (transient) is file status cached?
27  struct stat64 fStatBuffer; ///<! (transient) Cached file status buffer (for performance)
28 
29  TGFALFile() : fStatCached(kFALSE) { }
30 
31  // Interface to basic system I/O routines
32  Int_t SysOpen(const char *pathname, Int_t flags, UInt_t mode);
33  Int_t SysClose(Int_t fd);
34  Int_t SysRead(Int_t fd, void *buf, Int_t len);
35  Int_t SysWrite(Int_t fd, const void *buf, Int_t len);
36  Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence);
37  Int_t SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
38  Int_t SysSync(Int_t) { /* no fsync for GFAL */ return 0; }
39 
40 public:
41  TGFALFile(const char *url, Option_t *option="",
42  const char *ftitle="", Int_t compress=1);
43  ~TGFALFile();
44 
45  Bool_t ReadBuffer(char *buf, Int_t len);
46  Bool_t ReadBuffer(char *buf, Long64_t pos, Int_t len);
47  Bool_t WriteBuffer(const char *buf, Int_t len);
48 
49  ClassDef(TGFALFile,1) //A ROOT file that reads/writes via a GFAL
50 };
51 
52 
53 class TGFALSystem : public TSystem {
54 
55 private:
56  void *fDirp; // directory handler
57 
58  void *GetDirPtr() const { return fDirp; }
59 
60 public:
61  TGFALSystem();
62  virtual ~TGFALSystem() { }
63 
64  Int_t MakeDirectory(const char *name);
65  void *OpenDirectory(const char *name);
66  void FreeDirectory(void *dirp);
67  const char *GetDirEntry(void *dirp);
68  Int_t GetPathInfo(const char *path, FileStat_t &buf);
69  Bool_t AccessPathName(const char *path, EAccessMode mode);
70 
71  ClassDef(TGFALSystem,0) // Directory handler for GFAL
72 };
73 
74 #endif
struct stat64 fStatBuffer
! (transient) Cached file status buffer (for performance)
Definition: TGFALFile.h:27
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:205
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:215
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TGFALSystem()
Create helper class that allows directory access via GFAL.
Definition: TGFALFile.cxx:345
Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence)
Interface to system lseek.
Definition: TGFALFile.cxx:237
Bool_t WriteBuffer(const char *buf, Int_t len)
Write specified byte range to remote file via GFAL.
Definition: TGFALFile.cxx:321
void * GetDirPtr() const
Definition: TGFALFile.h:58
Int_t SysSync(Int_t)
Interface to system fsync. All arguments like in POSIX fsync().
Definition: TGFALFile.h:38
const char * GetDirEntry(void *dirp)
Get directory entry via GFAL. Returns 0 in case no more entries.
Definition: TGFALFile.cxx:410
#define ClassDef(name, id)
Definition: Rtypes.h:254
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:248
Bool_t fStatCached
! (transient) is file status cached?
Definition: TGFALFile.h:26
TGFALFile()
Definition: TGFALFile.h:29
Bool_t ReadBuffer(char *buf, Int_t len)
Read specified byte range from remote file via GFAL.
Definition: TGFALFile.cxx:288
Read and write data via the underlying Grid access mechanism.
Definition: TGFALFile.h:23
void FreeDirectory(void *dirp)
Free directory via GFAL.
Definition: TGFALFile.cxx:394
void * fDirp
Definition: TGFALFile.h:56
Int_t GetPathInfo(const char *path, FileStat_t &buf)
Get info about a file.
Definition: TGFALFile.cxx:434
virtual ~TGFALSystem()
Definition: TGFALFile.h:62
unsigned int UInt_t
Definition: RtypesCore.h:42
~TGFALFile()
GFAL file dtor. Close and flush directory structure.
Definition: TGFALFile.cxx:187
Int_t MakeDirectory(const char *name)
Make a directory via GFAL.
Definition: TGFALFile.cxx:356
long Long_t
Definition: RtypesCore.h:50
EAccessMode
Definition: TSystem.h:54
#define name(a, b)
Definition: linkTestLib0.cpp:5
Directory handler for GFAL.
Definition: TGFALFile.h:53
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:258
void * OpenDirectory(const char *name)
Open a directory via GFAL.
Definition: TGFALFile.cxx:369
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:195
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:225
Bool_t AccessPathName(const char *path, EAccessMode mode)
Returns FALSE if one can access a file using the specified access mode.
Definition: TGFALFile.cxx:461