Logo ROOT   master
Reference Guide
TAlienSystem.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Andreas Peters 15/05/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, 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_TAlienSystem
13 #define ROOT_TAlienSystem
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TAlienSystem //
18 // //
19 // TSystem Implementation of the AliEn GRID plugin. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef __CINT__
24 #include <stdio.h>
25 #endif
26 
27 #include "TSystem.h"
28 
29 class TAlienSystem : public TSystem {
30 
31 protected:
32  char fWorkingDirectory[1024];
33 
34 public:
35  TAlienSystem(const char *name = "Generic", const char *title = "Generic System");
36  virtual ~TAlienSystem();
37 
38  //---- Misc
39  virtual Bool_t Init();
40 
41  //---- Directories
42  virtual int MakeDirectory(const char *name);
43  virtual void *OpenDirectory(const char *name);
44  virtual void FreeDirectory(void *dirp);
45  virtual const char *GetDirEntry(void *dirp);
46  virtual void *GetDirPtr() const { return 0; }
47  virtual Bool_t ChangeDirectory(const char *path);
48  virtual const char *WorkingDirectory();
49  virtual const char *HomeDirectory(const char *userName = 0);
50  virtual int mkdir(const char *name, Bool_t recursive = kFALSE);
51  Bool_t cd(const char *path) { return ChangeDirectory(path); }
52  const char *pwd() { return WorkingDirectory(); }
53 
54  //---- Paths & Files
55  virtual int CopyFile(const char *from, const char *to, Bool_t overwrite = kFALSE);
56  virtual int Rename(const char *from, const char *to);
57  virtual int Link(const char *from, const char *to);
58  virtual int Symlink(const char *from, const char *to);
59  virtual int Unlink(const char *name);
60  int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
61  int GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);
62  virtual int GetPathInfo(const char *path, FileStat_t &buf);
63  virtual int AlienFilestat(const char *fpath, FileStat_t &buf);
64  virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree);
65  virtual int Chmod(const char *file, UInt_t mode);
66  virtual int Umask(Int_t mask);
67  virtual int Utime(const char *file, Long_t modtime, Long_t actime);
68  virtual const char *FindFile(const char *search, TString& file, EAccessMode mode = kFileExists);
69  virtual Bool_t AccessPathName(const char *path, EAccessMode mode = kFileExists);
70 
71  //---- Users & Groups
72  virtual Int_t GetUid(const char *user = 0);
73  virtual Int_t GetGid(const char *group = 0);
74  virtual Int_t GetEffectiveUid();
75  virtual Int_t GetEffectiveGid();
76  virtual UserGroup_t *GetUserInfo(Int_t uid);
77  virtual UserGroup_t *GetUserInfo(const char *user = 0);
78  virtual UserGroup_t *GetGroupInfo(Int_t gid);
79  virtual UserGroup_t *GetGroupInfo(const char *group = 0);
80 
81  ClassDef(TAlienSystem,0) // System interface to the Alien Catalogue
82 };
83 
84 #endif
char fWorkingDirectory[1024]
Definition: TAlienSystem.h:32
virtual UserGroup_t * GetGroupInfo(Int_t gid)
Returns all group info in the UserGroup_t structure.
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
long long Long64_t
Definition: RtypesCore.h:69
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual int Utime(const char *file, Long_t modtime, Long_t actime)
Set the a files modification and access times.
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
virtual Int_t GetEffectiveGid()
Returns the effective group id.
bool Bool_t
Definition: RtypesCore.h:59
virtual int Umask(Int_t mask)
Set the process file creation mode mask.
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
virtual int AlienFilestat(const char *fpath, FileStat_t &buf)
Get info about a file.
#define ClassDef(name, id)
Definition: Rtypes.h:326
Bool_t cd(const char *path)
Definition: TAlienSystem.h:51
virtual const char * HomeDirectory(const char *userName=0)
Return the user&#39;s home directory.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual Bool_t Init()
Initialize the OS interface.
virtual UserGroup_t * GetUserInfo(Int_t uid)
Returns all user info in the UserGroup_t structure.
virtual Int_t GetEffectiveUid()
Returns the effective user id.
TAlienSystem(const char *name="Generic", const char *title="Generic System")
Create a new OS interface.
virtual int Symlink(const char *from, const char *to)
Create a symbolic link from file1 to file2.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
virtual Int_t GetGid(const char *group=0)
Returns the group&#39;s id. If group = 0, returns current user&#39;s group.
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual Int_t GetUid(const char *user=0)
Returns the user&#39;s id. If user = 0, returns current user&#39;s id.
const Bool_t kFALSE
Definition: RtypesCore.h:88
virtual void * GetDirPtr() const
Definition: TAlienSystem.h:46
long Long_t
Definition: RtypesCore.h:50
virtual int Link(const char *from, const char *to)
Create a link from file1 to file2.
virtual int Chmod(const char *file, UInt_t mode)
Set the file permission bits. Returns -1 in case or error, 0 otherwise.
EAccessMode
Definition: TSystem.h:43
virtual ~TAlienSystem()
Delete the OS interface.
Definition: file.py:1
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual int MakeDirectory(const char *name)
Make a directory.
const char * pwd()
Definition: TAlienSystem.h:52
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:266
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks...
char name[80]
Definition: TGX11.cxx:109
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual const char * WorkingDirectory()
Return working directory.