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 class LStoreFile : public Storage
9 {
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);
16 
17  virtual void create (const char *name,
18  bool exclusive = false,
19  int perms = 0666);
20  virtual void create (const std::string &name,
21  bool exclusive = false,
22  int perms = 0666);
23  virtual void open (const char *name,
25  int perms = 0666);
26  virtual void open (const std::string &name,
28  int perms = 0666);
29 
30  using Storage::read;
31  using Storage::write;
32  using Storage::position;
33 
34  virtual IOSize read (void *into, IOSize n);
35  virtual IOSize write (const void *from, IOSize n);
36 
37  virtual IOOffset position (IOOffset offset, Relative whence = SET);
38  virtual void resize (IOOffset size);
39 
40  virtual void close (void);
41  virtual void abort (void);
42 
43  class MutexWrapper {
44  public:
45  MutexWrapper( pthread_mutex_t * lock );
46  ~MutexWrapper();
47  pthread_mutex_t * m_lock;
48  };
49 
50  static pthread_mutex_t m_dlopen_lock;
51 
52 private:
53  // functions
54 
55  void loadLibrary();
56  void closeLibrary();
57 
58  //data
59 
60  void * m_fd;
61  bool m_close;
65 
66  // Prototypes for functions
67  // These are data members that are function pointers.
68 
69  int32_t (*redd_init)();
70  int64_t (*redd_read)(void *, char*, int64_t);
71  int32_t (*redd_close)(void *);
72  int64_t (*redd_lseek)(void *, int64_t, uint32_t);
73  void * (*redd_open)(const char *, int32_t, int32_t );
74  int64_t (*redd_write)(void *, const char *, int64_t);
75  int32_t (*redd_term)();
76  int32_t (*redd_errno)();
77  const std::string & (*redd_strerror)();
78 };
79 
80 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
81 
void loadLibrary()
Definition: LStoreFile.cc:99
int32_t(* redd_errno)()
Definition: LStoreFile.h:76
void * m_library_handle
Definition: LStoreFile.h:63
int64_t(* redd_lseek)(void *, int64_t, uint32_t)
Definition: LStoreFile.h:72
pthread_mutex_t * m_lock
Definition: LStoreFile.h:47
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
virtual void resize(IOOffset size)
Definition: LStoreFile.cc:348
std::string m_name
Definition: LStoreFile.h:62
int32_t(* redd_init)()
Definition: LStoreFile.h:69
Relative
Definition: Storage.h:23
int32_t(* redd_term)()
Definition: LStoreFile.h:75
bool m_close
Definition: LStoreFile.h:61
void * m_fd
Definition: LStoreFile.h:60
int64_t(* redd_write)(void *, const char *, int64_t)
Definition: LStoreFile.h:74
MutexWrapper(pthread_mutex_t *lock)
Definition: LStoreFile.cc:357
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
virtual IOOffset position(void) const
Definition: Storage.cc:95
int read(void)
Definition: IOInput.cc:54
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: LStoreFile.cc:193
virtual void abort(void)
Definition: LStoreFile.cc:278
void closeLibrary()
Definition: LStoreFile.cc:135
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
bool m_is_loaded
Definition: LStoreFile.h:64
virtual IOSize write(const void *from, IOSize n)
Definition: LStoreFile.cc:306
int32_t(* redd_close)(void *)
Definition: LStoreFile.h:71
int64_t(* redd_read)(void *, char *, int64_t)
Definition: LStoreFile.h:70
LStoreFile(void)
Definition: LStoreFile.cc:18
static pthread_mutex_t m_dlopen_lock
Definition: LStoreFile.h:50
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: LStoreFile.cc:165
size_t IOSize
Definition: IOTypes.h:14
virtual void close(void)
Definition: LStoreFile.cc:253
~LStoreFile(void)
Definition: LStoreFile.cc:74