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) override;
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  IOSize read(void *into, IOSize n) override;
31  IOSize readv(IOBuffer *into, IOSize buffers) override;
32  IOSize readv(IOPosBuffer *into, IOSize buffers) override;
33  IOSize write(const void *from, IOSize n) override;
34  IOOffset position(IOOffset offset, Relative whence = SET) override;
35  void resize(IOOffset size) override;
36 
37  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
IOSize write(const void *from, IOSize n) override
Definition: DavixFile.cc:345
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: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
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
void resize(IOOffset size) override
Definition: DavixFile.cc:376
std::string m_name
Definition: DavixFile.h:46
size_t IOSize
Definition: IOTypes.h:14
~DavixFile(void) override
Definition: DavixFile.cc:29
Davix_fd * m_fd
Definition: DavixFile.h:44