Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:45

0001 #ifndef DAVIX_ADAPTOR_DAVIX_FILE_H
0002 #define DAVIX_ADAPTOR_DAVIX_FILE_H
0003 
0004 #include "Utilities/StorageFactory/interface/IOFlags.h"
0005 #include "Utilities/StorageFactory/interface/Storage.h"
0006 #include <davix.hpp>
0007 
0008 namespace edm::storage {
0009   class DavixFile : public Storage {
0010   public:
0011     DavixFile(void);
0012     DavixFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
0013     DavixFile(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
0014     ~DavixFile(void) override;
0015     static void configureDavixLogLevel();
0016 
0017     virtual void create(const char *name, bool exclusive = false, int perms = 0666);
0018     virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
0019     virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
0020     virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
0021 
0022     using Storage::position;
0023     using Storage::read;
0024     using Storage::write;
0025 
0026     IOSize read(void *into, IOSize n) override;
0027     IOSize readv(IOBuffer *into, IOSize buffers) override;
0028     IOSize readv(IOPosBuffer *into, IOSize buffers) override;
0029     IOSize write(const void *from, IOSize n) override;
0030     IOOffset position(IOOffset offset, Relative whence = SET) override;
0031     void resize(IOOffset size) override;
0032 
0033     void close(void) override;
0034     virtual void abort(void);
0035 
0036   private:
0037     // Cannot use as C++ smart pointer for Davix_fd
0038     // Because Davix_fd is not available in C++ header files and
0039     // sizeof cannot with incomplete types
0040     Davix_fd *m_fd;
0041     std::unique_ptr<Davix::DavPosix> m_davixPosix;
0042     std::string m_name;
0043   };
0044 }  // namespace edm::storage
0045 #endif  // DAVIX_ADAPTOR_DAVIX_FILE_H