CMS 3D CMS Logo

RFIOFile.h
Go to the documentation of this file.
1 #ifndef RFIO_ADAPTOR_RFIO_FILE_H
2 #define RFIO_ADAPTOR_RFIO_FILE_H
3 
6 # include <string>
7 
9 class RFIOFile final : public Storage
10 {
11 public:
12  RFIOFile (void);
13  RFIOFile (IOFD fd);
14  RFIOFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
15  RFIOFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
16  ~RFIOFile (void);
17 
18  void create (const char *name,
19  bool exclusive = false,
20  int perms = 0666) ;
21  void create (const std::string &name,
22  bool exclusive = false,
23  int perms = 0666) ;
24  void open (const char *name,
26  int perms = 0666) ;
27  void open (const std::string &name,
29  int perms = 0666) ;
30 
31  using Storage::read;
32  using Storage::readv;
33  using Storage::write;
34  using Storage::position;
35 
36  virtual IOSize read (void *into, IOSize n) override;
37  virtual IOSize readv (IOPosBuffer *into, IOSize buffers) override;
38  virtual IOSize write (const void *from, IOSize n) override;
39  virtual IOOffset position (IOOffset offset, Relative whence = SET) override;
40  virtual void resize (IOOffset size) override;
41  virtual void close (void) override;
42  void abort (void) ;
43 
44 /*
45  * Note: we used to implement prefetch for RFIOFile, but it never got used in
46  * production due to memory leaks in the underlying library. This was removed
47  * in CMSSW 6 so we could default to storage-only if available.
48  */
49 
50 private:
51  ssize_t retryRead (void *into, IOSize n, int maxRetry = 10);
52  void reopen();
53 
55  bool m_close;
57  int m_flags;
58  int m_perms;
60 };
61 
62 #endif // RFIO_ADAPTOR_RFIO_FILE_H
bool m_close
Definition: RFIOFile.h:55
virtual void resize(IOOffset size) override
Definition: RFIOFile.cc:414
void abort(void)
Definition: RFIOFile.cc:245
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:31
virtual IOSize readv(IOPosBuffer *into, IOSize buffers) override
Definition: RFIOFile.cc:355
std::string m_name
Definition: RFIOFile.h:56
virtual IOSize write(const void *from, IOSize n) override
Definition: RFIOFile.cc:363
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
int m_flags
Definition: RFIOFile.h:57
void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: RFIOFile.cc:105
Relative
Definition: Storage.h:23
RFIOFile(void)
Definition: RFIOFile.cc:30
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
virtual IOOffset position(void) const
Definition: Storage.cc:95
void create(const char *name, bool exclusive=false, int perms=0666)
Definition: RFIOFile.cc:77
int read(void)
Definition: IOInput.cc:54
ssize_t retryRead(void *into, IOSize n, int maxRetry=10)
Definition: RFIOFile.cc:269
void reopen()
Definition: RFIOFile.cc:255
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
int IOFD
Definition: IOTypes.h:22
IOOffset m_curpos
Definition: RFIOFile.h:59
virtual void close(void) override
Definition: RFIOFile.cc:201
int m_perms
Definition: RFIOFile.h:58
size_t IOSize
Definition: IOTypes.h:14
IOFD m_fd
Definition: RFIOFile.h:54
~RFIOFile(void)
Definition: RFIOFile.cc:66