xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdOucFileInfo.hh
Go to the documentation of this file.
1 #ifndef __XRDOUCFILEINFO_HH__
2 #define __XRDOUCFILEINFO_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d O u c F i l e I n f o . h h */
6 /* */
7 /* (c) 2015 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Department of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <cctype>
33 #include <cstdlib>
34 #include <cstring>
35 #include <string>
36 
37 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
41 
42 class XrdOucFIHash;
43 class XrdOucFIUrl;
44 
46 {
47 public:
48 
49 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
55 
56 void AddDigest(const char *hname, const char *hval);
57 
58 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
69 
70 void AddUrl(const char *url, const char *cntry=0,
71  int prty=0, bool fifo=true);
72 
73 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
78 
79 void AddFileName(const char * filename);
80 
81 //-----------------------------------------------------------------------------
85 //-----------------------------------------------------------------------------
86 
87 void AddLfn(const char * lfn);
88 
89 //-----------------------------------------------------------------------------
93 //-----------------------------------------------------------------------------
94 
95 void AddProtocol(const char * protname);
96 
97 //-----------------------------------------------------------------------------
108 //-----------------------------------------------------------------------------
109 
110 const char *GetDigest(const char *&hval, bool xrdname=true);
111 
112 //-----------------------------------------------------------------------------
117 //-----------------------------------------------------------------------------
118 
119 const char *GetLfn() {return fLfn;}
120 
121 //-----------------------------------------------------------------------------
125 //-----------------------------------------------------------------------------
126 
127 const char *GetTargetName() {return fTargetName;}
128 
129 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
134 
135 long long GetSize() {return fSize;}
136 
137 //-----------------------------------------------------------------------------
149 //-----------------------------------------------------------------------------
150 
151 const char *GetUrl(char *cntry=0, int *prty=0);
152 
153 //-----------------------------------------------------------------------------
160 //-----------------------------------------------------------------------------
161 
162 bool HasProtocol(const char * protname);
163 
164 //-----------------------------------------------------------------------------
168 //-----------------------------------------------------------------------------
169 
170 void SetSize(long long fsz) {fSize = fsz;}
171 
172 //-----------------------------------------------------------------------------
176 //-----------------------------------------------------------------------------
177 
178  XrdOucFileInfo(const char *lfn=0)
179  : nextFile(0), fHash(0), fHashNext(0),
180  fUrl(0), fUrlNext(0), fTargetName(0), fSize(-1)
181  {if (lfn) fLfn = strdup(lfn);
182  else fLfn = 0;
183  }
184 
185 //-----------------------------------------------------------------------------
187 //-----------------------------------------------------------------------------
188 
189  ~XrdOucFileInfo();
190 
191 //-----------------------------------------------------------------------------
193 //-----------------------------------------------------------------------------
194 
196 
197 private:
198 
199 XrdOucFIHash *fHash;
200 XrdOucFIHash *fHashNext;
201 XrdOucFIUrl *fUrl;
202 XrdOucFIUrl *fUrlNext;
203 char *fLfn;
205 long long fSize;
206 std::string protList;
207 };
208 #endif
const char * GetLfn()
Definition: XrdOucFileInfo.hh:119
Definition: XrdOucFileInfo.hh:45
void SetSize(long long fsz)
Definition: XrdOucFileInfo.hh:170
const char * GetUrl(char *cntry=0, int *prty=0)
char * fTargetName
Definition: XrdOucFileInfo.hh:204
const char * GetDigest(const char *&hval, bool xrdname=true)
bool HasProtocol(const char *protname)
~XrdOucFileInfo()
Destructor.
std::string protList
Definition: XrdOucFileInfo.hh:206
void AddFileName(const char *filename)
void AddLfn(const char *lfn)
XrdOucFIUrl * fUrlNext
Definition: XrdOucFileInfo.hh:202
XrdOucFIHash * fHash
Definition: XrdOucFileInfo.hh:199
long long fSize
Definition: XrdOucFileInfo.hh:205
void AddUrl(const char *url, const char *cntry=0, int prty=0, bool fifo=true)
const char * GetTargetName()
Definition: XrdOucFileInfo.hh:127
void AddProtocol(const char *protname)
void AddDigest(const char *hname, const char *hval)
char * fLfn
Definition: XrdOucFileInfo.hh:203
XrdOucFIUrl * fUrl
Definition: XrdOucFileInfo.hh:201
long long GetSize()
Definition: XrdOucFileInfo.hh:135
XrdOucFileInfo(const char *lfn=0)
Definition: XrdOucFileInfo.hh:178
XrdOucFIHash * fHashNext
Definition: XrdOucFileInfo.hh:200
XrdOucFileInfo * nextFile
Link field to simply miltiple file processing.
Definition: XrdOucFileInfo.hh:195