CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Utilities/StorageFactory/interface/Storage.h

Go to the documentation of this file.
00001 #ifndef STORAGE_FACTORY_STORAGE_H
00002 # define STORAGE_FACTORY_STORAGE_H
00003 
00004 # include "Utilities/StorageFactory/interface/IOInput.h"
00005 # include "Utilities/StorageFactory/interface/IOOutput.h"
00006 # include "Utilities/StorageFactory/interface/IOPosBuffer.h"
00007 
00008 //
00009 // ROOT will probe for prefetching support by calling
00010 // ReadBufferAsync(0, 0)
00011 // Storage turns this into:
00012 // prefetch(0, PREFETCH_PROBE_LENGTH)
00013 //
00014 // For example, if the Storage implementation wants to provide a prefetch
00015 // implementation, but prefers it not to be used by default, it
00016 // should detect the probe and return true.
00017 //
00018 # define PREFETCH_PROBE_LENGTH 4096
00019 
00020 class Storage : public virtual IOInput, public virtual IOOutput
00021 {
00022 public:
00023   enum Relative { SET, CURRENT, END };
00024 
00025   Storage (void);
00026   virtual ~Storage (void);
00027 
00028   using IOInput::read;
00029   using IOInput::readv;
00030   using IOOutput::write;
00031   using IOOutput::writev;
00032 
00033   virtual bool          prefetch (const IOPosBuffer *what, IOSize n);
00034   virtual IOSize        read (void *into, IOSize n, IOOffset pos);
00035   IOSize                read (IOBuffer into, IOOffset pos);
00036   virtual IOSize        readv (IOPosBuffer *into, IOSize buffers);
00037   virtual IOSize        write (const void *from, IOSize n, IOOffset pos);
00038   IOSize                write (IOBuffer from, IOOffset pos);
00039   virtual IOSize        writev (const IOPosBuffer *from, IOSize buffers);
00040 
00041   virtual bool          eof (void) const;
00042   virtual IOOffset      size (void) const;
00043   virtual IOOffset      position (void) const;
00044   virtual IOOffset      position (IOOffset offset, Relative whence = SET) = 0;
00045 
00046   virtual void          rewind (void);
00047 
00048   virtual void          resize (IOOffset size) = 0;
00049 
00050   virtual void          flush (void);
00051   virtual void          close (void);
00052 
00053 private:
00054   // undefined, no semantics
00055   Storage (const Storage &);
00056   Storage &operator= (const Storage &);
00057 };
00058 
00059 #endif // STORAGE_FACTORY_STORAGE_H