CMS 3D CMS Logo

DavixFile.h
Go to the documentation of this file.
1 #ifndef DAVIX_ADAPTOR_DAVIX_FILE_H
2 #define DAVIX_ADAPTOR_DAVIX_FILE_H
3 
6 #include <davix.hpp>
7 
8 class DavixFile : public Storage {
9 public:
10  DavixFile(void);
11  DavixFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
12  DavixFile(const std::string &name, int flags = IOFlags::OpenRead,
13  int perms = 0666);
14  ~DavixFile(void);
15  static void configureDavixLogLevel();
16 
17  virtual void create(const char *name, bool exclusive = false,
18  int perms = 0666);
19  virtual void create(const std::string &name, bool exclusive = false,
20  int perms = 0666);
21  virtual void open(const char *name, int flags = IOFlags::OpenRead,
22  int perms = 0666);
23  virtual void open(const std::string &name, int flags = IOFlags::OpenRead,
24  int perms = 0666);
25 
26  using Storage::read;
27  using Storage::write;
28  using Storage::position;
29 
30  virtual IOSize read(void *into, IOSize n) override;
31  virtual IOSize readv(IOBuffer *into, IOSize buffers) override;
32  virtual IOSize readv(IOPosBuffer *into, IOSize buffers) override;
33  virtual IOSize write(const void *from, IOSize n) override;
34  virtual IOOffset position(IOOffset offset, Relative whence = SET) override;
35  virtual void resize(IOOffset size) override;
36 
37  virtual void close(void) override;
38  virtual void abort(void);
39 
40 private:
41  // Cannot use as C++ smart pointer for Davix_fd
42  // Because Davix_fd is not available in C++ header files and
43  // sizeof cannot with incomplete types
44  Davix_fd *m_fd;
45  std::unique_ptr<Davix::DavPosix> m_davixPosix;
47 };
48 
49 #endif // DAVIX_ADAPTOR_DAVIX_FILE_H
static void configureDavixLogLevel()
Definition: DavixFile.cc:66
virtual IOSize write(const void *from, IOSize n) override
Definition: DavixFile.cc:345
virtual IOSize readv(IOBuffer *into, IOSize buffers) override
Definition: DavixFile.cc:222
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
virtual void abort(void)
Definition: DavixFile.cc:50
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: DavixFile.cc:144
~DavixFile(void)
Definition: DavixFile.cc:29
DavixFile(void)
Definition: DavixFile.cc:18
Relative
Definition: Storage.h:23
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
virtual IOOffset position(void) const
Definition: Storage.cc:95
std::unique_ptr< Davix::DavPosix > m_davixPosix
Definition: DavixFile.h:45
virtual void close(void) override
Definition: DavixFile.cc:34
int read(void)
Definition: IOInput.cc:54
virtual IOOffset size(void) const
Definition: Storage.cc:102
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: DavixFile.cc:162
int64_t IOOffset
Definition: IOTypes.h:19
virtual void resize(IOOffset size) override
Definition: DavixFile.cc:376
std::string m_name
Definition: DavixFile.h:46
size_t IOSize
Definition: IOTypes.h:14
Davix_fd * m_fd
Definition: DavixFile.h:44