CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Utilities/LStoreAdaptor/interface/LStoreFile.h

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   // functions
00054 
00055   void loadLibrary();
00056   void closeLibrary();
00057 
00058   //data
00059 
00060   void *                m_fd;
00061   bool                  m_close;
00062   std::string           m_name;
00063   void * m_library_handle;
00064   bool m_is_loaded;
00065 
00066   // Prototypes for functions
00067   // These are data members that are function pointers.
00068 
00069   int32_t (*redd_init)();
00070   int64_t (*redd_read)(void *, char*, int64_t); 
00071   int32_t (*redd_close)(void *);
00072   int64_t (*redd_lseek)(void *, int64_t, uint32_t);
00073   void * (*redd_open)(const char *, int32_t, int32_t );
00074   int64_t (*redd_write)(void *, const char *, int64_t);
00075   int32_t (*redd_term)();
00076   int32_t (*redd_errno)();
00077   const std::string & (*redd_strerror)();
00078 };
00079 
00080 #endif // LSTORE_ADAPTOR_LSTORE_FILE_H
00081