CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  void * m_fd;
54  bool m_close;
55  std::string m_name;
56  void loadLibrary();
57  void closeLibrary();
60 
61  // Prototypes for
62 
63  int32_t (*redd_init)();
64  int64_t (*redd_read)(void *, char*, int64_t);
65  int32_t (*redd_close)(void *);
66  int64_t (*redd_lseek)(void *, int64_t, uint32_t);
67  void * (*redd_open)(const char *, int32_t, int32_t );
68  int64_t (*redd_write)(void *, const char *, int64_t);
69  int32_t (*redd_term)();
70  int32_t (*redd_errno)();
71  const std::string & (*redd_strerror)();
72 };
73 
74 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
75 
void loadLibrary()
Definition: LStoreFile.cc:75
void * m_library_handle
Definition: LStoreFile.h:58
int32_t(* redd_init)()
Definition: LStoreFile.h:63
pthread_mutex_t * m_lock
Definition: LStoreFile.h:47
int64_t(* redd_read)(void *, char *, int64_t)
Definition: LStoreFile.h:64
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
Definition: Storage.h:8
virtual void resize(IOOffset size)
Definition: LStoreFile.cc:325
std::string m_name
Definition: LStoreFile.h:55
Relative
Definition: Storage.h:11
bool m_close
Definition: LStoreFile.h:54
void * m_fd
Definition: LStoreFile.h:53
MutexWrapper(pthread_mutex_t *lock)
Definition: LStoreFile.cc:334
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
virtual IOOffset position(void) const
Definition: Storage.cc:95
int64_t(* redd_lseek)(void *, int64_t, uint32_t)
Definition: LStoreFile.h:66
int read(void)
Definition: IOInput.cc:54
unsigned int offset(bool)
int32_t(* redd_close)(void *)
Definition: LStoreFile.h:65
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: LStoreFile.cc:169
int64_t(* redd_write)(void *, const char *, int64_t)
Definition: LStoreFile.h:68
virtual void abort(void)
Definition: LStoreFile.cc:255
static std::string from(" from ")
void closeLibrary()
Definition: LStoreFile.cc:111
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
bool m_is_loaded
Definition: LStoreFile.h:59
virtual IOSize write(const void *from, IOSize n)
Definition: LStoreFile.cc:283
LStoreFile(void)
Definition: LStoreFile.cc:16
static pthread_mutex_t m_dlopen_lock
Definition: LStoreFile.h:50
int32_t(* redd_errno)()
Definition: LStoreFile.h:70
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: LStoreFile.cc:141
size_t IOSize
Definition: IOTypes.h:14
virtual void close(void)
Definition: LStoreFile.cc:230
int32_t(* redd_term)()
Definition: LStoreFile.h:69
~LStoreFile(void)
Definition: LStoreFile.cc:50