Go to the documentation of this file.00001 #ifndef LSTORE_ADAPTOR_LSTORE_FILE_H
00002 # define LSTORE_ADAPTOR_LSTORE_FILE_H
00003
00004 # include "Utilities/StorageFactory/interface/Storage.h"
00005 # include "Utilities/StorageFactory/interface/IOFlags.h"
00006 # include <string>
00007 #include <pthread.h>
00008 class LStoreFile : public Storage
00009 {
00010 public:
00011 LStoreFile (void);
00012 LStoreFile (void * fd);
00013 LStoreFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
00014 LStoreFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
00015 ~LStoreFile (void);
00016
00017 virtual void create (const char *name,
00018 bool exclusive = false,
00019 int perms = 0666);
00020 virtual void create (const std::string &name,
00021 bool exclusive = false,
00022 int perms = 0666);
00023 virtual void open (const char *name,
00024 int flags = IOFlags::OpenRead,
00025 int perms = 0666);
00026 virtual void open (const std::string &name,
00027 int flags = IOFlags::OpenRead,
00028 int perms = 0666);
00029
00030 using Storage::read;
00031 using Storage::write;
00032 using Storage::position;
00033
00034 virtual IOSize read (void *into, IOSize n);
00035 virtual IOSize write (const void *from, IOSize n);
00036
00037 virtual IOOffset position (IOOffset offset, Relative whence = SET);
00038 virtual void resize (IOOffset size);
00039
00040 virtual void close (void);
00041 virtual void abort (void);
00042
00043 class MutexWrapper {
00044 public:
00045 MutexWrapper( pthread_mutex_t * lock );
00046 ~MutexWrapper();
00047 pthread_mutex_t * m_lock;
00048 };
00049
00050 static pthread_mutex_t m_dlopen_lock;
00051
00052 private:
00053 void * m_fd;
00054 bool m_close;
00055 std::string m_name;
00056 void loadLibrary();
00057 void closeLibrary();
00058 void * m_library_handle;
00059 bool m_is_loaded;
00060
00061
00062
00063 int32_t (*redd_init)();
00064 int64_t (*redd_read)(void *, char*, int64_t);
00065 int32_t (*redd_close)(void *);
00066 int64_t (*redd_lseek)(void *, int64_t, uint32_t);
00067 void * (*redd_open)(const char *, int32_t, int32_t );
00068 int64_t (*redd_write)(void *, const char *, int64_t);
00069 int32_t (*redd_term)();
00070 int32_t (*redd_errno)();
00071 const std::string & (*redd_strerror)();
00072 };
00073
00074 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
00075