CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XrdFile.h
Go to the documentation of this file.
1 #ifndef Utilities_XrdAdaptor_XrdFile_h
2 #define Utilities_XrdAdaptor_XrdFile_h
3 
7 # include "XrdCl/XrdClFile.hh"
8 # include <string>
9 # include <memory>
10 # include <atomic>
11 
12 namespace XrdAdaptor {
13 class RequestManager;
14 }
15 
16 class XrdFile : public Storage
17 {
18 public:
19  XrdFile (void);
20  XrdFile (IOFD fd);
21  XrdFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
22  XrdFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
23  ~XrdFile (void);
24 
25  virtual void create (const char *name,
26  bool exclusive = false,
27  int perms = 0666);
28  virtual void create (const std::string &name,
29  bool exclusive = false,
30  int perms = 0666);
31  virtual void open (const char *name,
33  int perms = 0666);
34  virtual void open (const std::string &name,
36  int perms = 0666);
37 
38  using Storage::read;
39  using Storage::readv;
40  using Storage::write;
41  using Storage::position;
42 
43  virtual bool prefetch (const IOPosBuffer *what, IOSize n);
44  virtual IOSize read (void *into, IOSize n);
45  virtual IOSize read (void *into, IOSize n, IOOffset pos);
46  virtual IOSize readv (IOBuffer *into, IOSize n);
47  virtual IOSize readv (IOPosBuffer *into, IOSize n);
48  virtual IOSize write (const void *from, IOSize n);
49  virtual IOSize write (const void *from, IOSize n, IOOffset pos);
50 
51  virtual IOOffset position (IOOffset offset, Relative whence = SET);
52  virtual void resize (IOOffset size);
53 
54  virtual void close (void);
55  virtual void abort (void);
56 
57 private:
58 
60 
65  std::shared_ptr<XrdCl::File> getActiveFile();
66 
67  std::shared_ptr<XrdAdaptor::RequestManager> m_requestmanager;
70  bool m_close;
72  std::atomic<unsigned int> m_op_count;
73 
74 };
75 
76 #endif // XRD_ADAPTOR_XRD_FILE_H
virtual void resize(IOOffset size)
Definition: XrdFile.cc:539
std::shared_ptr< XrdAdaptor::RequestManager > m_requestmanager
Definition: XrdFile.h:67
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:31
virtual void close(void)
Definition: XrdFile.cc:194
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: XrdFile.cc:63
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
bool m_close
Definition: XrdFile.h:70
IOOffset m_offset
Definition: XrdFile.h:68
Relative
Definition: Storage.h:23
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Definition: XrdFile.cc:485
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
XrdFile(void)
Definition: XrdFile.cc:20
virtual IOOffset position(void) const
Definition: Storage.cc:95
std::atomic< unsigned int > m_op_count
Definition: XrdFile.h:72
virtual IOSize readv(IOBuffer *into, IOSize n)
Definition: XrdFile.cc:259
int read(void)
Definition: IOInput.cc:54
std::shared_ptr< XrdCl::File > getActiveFile()
Definition: XrdFile.cc:549
IOOffset m_size
Definition: XrdFile.h:69
std::string m_name
Definition: XrdFile.h:71
~XrdFile(void)
Definition: XrdFile.cc:53
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
int IOFD
Definition: IOTypes.h:22
size_t IOSize
Definition: IOTypes.h:14
void addConnection(cms::Exception &)
Definition: XrdFile.cc:564
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: XrdFile.cc:91
virtual IOSize write(const void *from, IOSize n)
Definition: XrdFile.cc:424
virtual void abort(void)
Definition: XrdFile.cc:214