CMS 3D CMS Logo

LStoreFile.h
Go to the documentation of this file.
1 #ifndef LSTORE_ADAPTOR_LSTORE_FILE_H
2 #define LSTORE_ADAPTOR_LSTORE_FILE_H
3 
6 #include <string>
7 #include <pthread.h>
8 namespace edm::storage {
9  class LStoreFile : public Storage {
10  public:
11  LStoreFile(void);
12  LStoreFile(void *fd);
13  LStoreFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
14  LStoreFile(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
15  ~LStoreFile(void) override;
16 
17  virtual void create(const char *name, bool exclusive = false, int perms = 0666);
18  virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
19  virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
20  virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
21 
22  using Storage::position;
23  using Storage::read;
24  using Storage::write;
25 
26  IOSize read(void *into, IOSize n) override;
27  IOSize write(const void *from, IOSize n) override;
28 
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  class MutexWrapper {
36  public:
37  MutexWrapper(pthread_mutex_t *lock);
38  ~MutexWrapper();
39  pthread_mutex_t *m_lock;
40  };
41 
42  static pthread_mutex_t m_dlopen_lock;
43 
44  private:
45  // functions
46 
47  void loadLibrary();
48  void closeLibrary();
49 
50  //data
51 
52  void *m_fd;
53  bool m_close;
57 
58  // Prototypes for functions
59  // These are data members that are function pointers.
60 
61  int32_t (*redd_init)();
62  int64_t (*redd_read)(void *, char *, int64_t);
63  int32_t (*redd_close)(void *);
64  int64_t (*redd_lseek)(void *, int64_t, uint32_t);
65  void *(*redd_open)(const char *, int32_t, int32_t);
66  int64_t (*redd_write)(void *, const char *, int64_t);
67  int32_t (*redd_term)();
68  int32_t (*redd_errno)();
69  const std::string &(*redd_strerror)();
70  };
71 } // namespace edm::storage
72 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
int64_t IOOffset
Definition: IOTypes.h:20
int64_t(* redd_read)(void *, char *, int64_t)
Definition: LStoreFile.h:62
IOSize write(const void *from, IOSize n) override
Definition: LStoreFile.cc:249
void close(void) override
Definition: LStoreFile.cc:210
virtual void abort(void)
Definition: LStoreFile.cc:228
int64_t(* redd_lseek)(void *, int64_t, uint32_t)
Definition: LStoreFile.h:64
int32_t(* redd_close)(void *)
Definition: LStoreFile.h:63
MutexWrapper(pthread_mutex_t *lock)
Definition: LStoreFile.cc:286
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: LStoreFile.cc:143
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: LStoreFile.cc:159
int64_t(* redd_write)(void *, const char *, int64_t)
Definition: LStoreFile.h:66
virtual IOOffset size() const
Definition: Storage.cc:509
~LStoreFile(void) override
Definition: LStoreFile.cc:66
int32_t(* redd_term)()
Definition: LStoreFile.h:67
int32_t(* redd_errno)()
Definition: LStoreFile.h:68
void resize(IOOffset size) override
Definition: LStoreFile.cc:280
size_t IOSize
Definition: IOTypes.h:15
IOSize write(unsigned char byte)
Definition: Storage.cc:329
int32_t(* redd_init)()
Definition: LStoreFile.h:61
virtual IOOffset position() const
Definition: Storage.cc:504
fd
Definition: ztee.py:136
static pthread_mutex_t m_dlopen_lock
Definition: LStoreFile.h:42