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, int perms = 0666);
13  ~DavixFile(void) override;
14  static void configureDavixLogLevel();
15 
16  virtual void create(const char *name, bool exclusive = false, int perms = 0666);
17  virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
18  virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
19  virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
20 
21  using Storage::position;
22  using Storage::read;
23  using Storage::write;
24 
25  IOSize read(void *into, IOSize n) override;
26  IOSize readv(IOBuffer *into, IOSize buffers) override;
27  IOSize readv(IOPosBuffer *into, IOSize buffers) override;
28  IOSize write(const void *from, IOSize n) override;
29  IOOffset position(IOOffset offset, Relative whence = SET) override;
30  void resize(IOOffset size) override;
31 
32  void close(void) override;
33  virtual void abort(void);
34 
35 private:
36  // Cannot use as C++ smart pointer for Davix_fd
37  // Because Davix_fd is not available in C++ header files and
38  // sizeof cannot with incomplete types
39  Davix_fd *m_fd;
40  std::unique_ptr<Davix::DavPosix> m_davixPosix;
42 };
43 
44 #endif // DAVIX_ADAPTOR_DAVIX_FILE_H
static void configureDavixLogLevel()
Definition: DavixFile.cc:67
IOSize write(const void *from, IOSize n) override
Definition: DavixFile.cc:341
IOSize readv(IOBuffer *into, IOSize buffers) override
Definition: DavixFile.cc:220
virtual void abort(void)
Definition: DavixFile.cc:51
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: DavixFile.cc:144
DavixFile(void)
Definition: DavixFile.cc:18
Relative
Definition: Storage.h:22
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:44
virtual IOOffset position(void) const
Definition: Storage.cc:72
std::unique_ptr< Davix::DavPosix > m_davixPosix
Definition: DavixFile.h:40
void close(void) override
Definition: DavixFile.cc:33
int read(void)
Definition: IOInput.cc:52
virtual IOOffset size(void) const
Definition: Storage.cc:77
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: DavixFile.cc:160
int64_t IOOffset
Definition: IOTypes.h:19
void resize(IOOffset size) override
Definition: DavixFile.cc:371
std::string m_name
Definition: DavixFile.h:41
size_t IOSize
Definition: IOTypes.h:14
~DavixFile(void) override
Definition: DavixFile.cc:28
Davix_fd * m_fd
Definition: DavixFile.h:39