Logo ROOT  
Reference Guide
TAlienFile.h
Go to the documentation of this file.
1// @(#)root/alien:$Id$
2// Author: Andreas Peters 11/09/2003
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_TAlienFile
13#define ROOT_TAlienFile
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TAlienFile //
18// //
19// A TAlienFile is like a normal TFile except that it reads and writes //
20// it's data via TXNetFile and gets authorization and the TXNetFile //
21// URL from an alien service. //
22// //
23// Filenames are standard URL format with protocol "alien". //
24// The following are valid TAlienFile URL's: //
25// //
26// alien:///alice/cern.ch/user/p/peters/test.root //
27// /alien/alice/cern.ch/user/p/peters/test.root //
28// //
29// - notice that URLs like /alien/alice... are converted internally //
30// to alien://alice... //
31// //
32//////////////////////////////////////////////////////////////////////////
33
34#include "TXNetFile.h"
35
36
37class TUrl;
38
39class TAlienFile : public TXNetFile {
40
41private:
42 TString fLfn; // logical file name
43 TString fAuthz; // authorization envelope
44 TString fGUID; // GUID
45 TString fUrl; // url for the opened copy
46 TString fPfn; // physical file name
47 TString fSE; // Storage element
48 Int_t fImage; // Image number
49 Int_t fNreplicas; // Number of replicas
50 Long64_t fOpenedAt; // Absolute value for time when opened
51 Double_t fElapsed; // Time elapsed to opem file
52public:
53 TAlienFile() : TXNetFile(), fLfn(), fAuthz(), fGUID(), fUrl(), fPfn(), fSE(), fImage(0), fNreplicas(0), fOpenedAt(0), fElapsed(0) { }
54 TAlienFile(const char *purl, Option_t *option = "",
55 const char *ftitle = "", Int_t compress = ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault,
56 Bool_t parallelopen = kFALSE, const char *lurl = 0,
57 const char *authz = 0);
58 virtual ~TAlienFile();
59
60 virtual void Close(const Option_t *opt = "");
61
62 const char *GetGUID() const {return fGUID;}
63 Double_t GetElapsed() const {return fElapsed;}
64 Int_t GetImage() const {return fImage;}
65 const char *GetLfn() const {return fLfn;}
66 Int_t GetNreplicas() const {return fNreplicas;}
67 Long64_t GetOpenTime() const {return fOpenedAt;}
68 const char *GetPfn() const {return fPfn;}
69 const char *GetSE() const {return fSE;}
70 const char *GetUrl() const {return fUrl;}
71
72protected:
73 void SetGUID(const char *guid) {fGUID = guid;}
74 void SetElapsed(Double_t real) {fElapsed = real;}
75 void SetImage(Int_t image) {fImage = image;}
76 void SetNreplicas(Int_t nrep) {fNreplicas = nrep;}
77 void SetPfn(const char *pfn) {fPfn = pfn;}
78 void SetSE(const char *se) {fSE = se;}
79 void SetUrl(const char *url) {fUrl = url;}
80
81public:
82 static TAlienFile *Open(const char *lfn, const Option_t *option = "",
84 Bool_t parallelopen = kFALSE);
85 static TString SUrl(const char *lfn);
86
87 ClassDef(TAlienFile, 4) //A ROOT file that reads/writes via AliEn services and TXNetFile protocol
88};
89
90#endif
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
TString fSE
Definition: TAlienFile.h:47
TString fLfn
Definition: TAlienFile.h:42
void SetElapsed(Double_t real)
Definition: TAlienFile.h:74
TString fPfn
Definition: TAlienFile.h:46
Int_t fNreplicas
Definition: TAlienFile.h:49
static TString SUrl(const char *lfn)
Get surl from lfn by asking AliEn catalog.
Definition: TAlienFile.cxx:612
Double_t GetElapsed() const
Definition: TAlienFile.h:63
void SetUrl(const char *url)
Definition: TAlienFile.h:79
Long64_t GetOpenTime() const
Definition: TAlienFile.h:67
const char * GetPfn() const
Definition: TAlienFile.h:68
Int_t GetNreplicas() const
Definition: TAlienFile.h:66
const char * GetSE() const
Definition: TAlienFile.h:69
void SetPfn(const char *pfn)
Definition: TAlienFile.h:77
TString fUrl
Definition: TAlienFile.h:45
virtual ~TAlienFile()
TAlienFile file dtor.
Definition: TAlienFile.cxx:534
const char * GetGUID() const
Definition: TAlienFile.h:62
Double_t fElapsed
Definition: TAlienFile.h:51
TString fGUID
Definition: TAlienFile.h:44
static TAlienFile * Open(const char *lfn, const Option_t *option="", const char *title="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Bool_t parallelopen=kFALSE)
Static method used to create a TAlienFile object.
Definition: TAlienFile.cxx:104
TString fAuthz
Definition: TAlienFile.h:43
Int_t GetImage() const
Definition: TAlienFile.h:64
Long64_t fOpenedAt
Definition: TAlienFile.h:50
const char * GetLfn() const
Definition: TAlienFile.h:65
void SetSE(const char *se)
Definition: TAlienFile.h:78
Int_t fImage
Definition: TAlienFile.h:48
const char * GetUrl() const
Definition: TAlienFile.h:70
void SetGUID(const char *guid)
Definition: TAlienFile.h:73
virtual void Close(const Option_t *opt="")
Close the file.
Definition: TAlienFile.cxx:546
void SetNreplicas(Int_t nrep)
Definition: TAlienFile.h:76
void SetImage(Int_t image)
Definition: TAlienFile.h:75
Basic string class.
Definition: TString.h:131
This class represents a WWW compatible URL.
Definition: TUrl.h:35
@ kUseCompiledDefault
Use the compile-time default setting.
Definition: Compression.h:50