CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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   using Storage::prefetch;
00036 
00037   virtual bool          prefetch (const IOPosBuffer *what, IOSize n);
00038   virtual IOSize        read (void *into, IOSize n);
00039   virtual IOSize        readv (IOPosBuffer *into, IOSize buffers);
00040   virtual IOSize        write (const void *from, IOSize n);
00041   virtual IOOffset      position (IOOffset offset, Relative whence = SET);
00042   virtual void          resize (IOOffset size);
00043   virtual void          close (void);
00044   virtual void          abort (void);
00045 
00046 private:
00047   ssize_t               retryRead (void *into, IOSize n, int maxRetry = 10);
00048   void                  reopen();
00049 
00050   IOFD                  m_fd;
00051   bool                  m_close;
00052   std::string           m_name;
00053   int                   m_flags;
00054   int                   m_perms;
00055   IOOffset              m_curpos;
00056 };
00057 
00058 #endif // RFIO_ADAPTOR_RFIO_FILE_H