CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Utilities/RFIOAdaptor/interface/RFIOFile.h

Go to the documentation of this file.
00001 #ifndef RFIO_ADAPTOR_RFIO_FILE_H
00002 #define RFIO_ADAPTOR_RFIO_FILE_H
00003 
00004 # include "Utilities/StorageFactory/interface/Storage.h"
00005 # include "Utilities/StorageFactory/interface/IOFlags.h"
00006 # include <string>
00007 
00009 class RFIOFile : public Storage
00010 {
00011 public:
00012   RFIOFile (void);
00013   RFIOFile (IOFD fd);
00014   RFIOFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
00015   RFIOFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
00016   ~RFIOFile (void);
00017 
00018   virtual void          create (const char *name,
00019                                 bool exclusive = false,
00020                                 int perms = 0666);
00021   virtual void          create (const std::string &name,
00022                                 bool exclusive = false,
00023                                 int perms = 0666);
00024   virtual void          open (const char *name,
00025                               int flags = IOFlags::OpenRead,
00026                               int perms = 0666);
00027   virtual void          open (const std::string &name,
00028                               int flags = IOFlags::OpenRead,
00029                               int perms = 0666);
00030 
00031   using Storage::read;
00032   using Storage::readv;
00033   using Storage::write;
00034   using Storage::position;
00035 
00036   virtual IOSize        read (void *into, IOSize n);
00037   virtual IOSize        readv (IOPosBuffer *into, IOSize buffers);
00038   virtual IOSize        write (const void *from, IOSize n);
00039   virtual IOOffset      position (IOOffset offset, Relative whence = SET);
00040   virtual void          resize (IOOffset size);
00041   virtual void          close (void);
00042   virtual void          abort (void);
00043 
00044 /*
00045  * Note: we used to implement prefetch for RFIOFile, but it never got used in
00046  * production due to memory leaks in the underlying library.  This was removed
00047  * in CMSSW 6 so we could default to storage-only if available.
00048  */
00049 
00050 private:
00051   ssize_t               retryRead (void *into, IOSize n, int maxRetry = 10);
00052   void                  reopen();
00053 
00054   IOFD                  m_fd;
00055   bool                  m_close;
00056   std::string           m_name;
00057   int                   m_flags;
00058   int                   m_perms;
00059   IOOffset              m_curpos;
00060 };
00061 
00062 #endif // RFIO_ADAPTOR_RFIO_FILE_H