Go to the documentation of this file.00001 #ifndef STORAGE_FACTORY_LOCAL_CACHE_FILE_H
00002 # define STORAGE_FACTORY_LOCAL_CACHE_FILE_H
00003
00004 # include "Utilities/StorageFactory/interface/Storage.h"
00005 # include "Utilities/StorageFactory/interface/File.h"
00006 # include <vector>
00007 # include <string>
00008
00010 class LocalCacheFile : public Storage
00011 {
00012 public:
00013 LocalCacheFile (Storage *base, const std::string &tmpdir = "");
00014 ~LocalCacheFile (void);
00015
00016 using Storage::read;
00017 using Storage::write;
00018
00019 virtual bool prefetch (const IOPosBuffer *what, IOSize n);
00020 virtual IOSize read (void *into, IOSize n);
00021 virtual IOSize read (void *into, IOSize n, IOOffset pos);
00022 virtual IOSize readv (IOBuffer *into, IOSize n);
00023 virtual IOSize readv (IOPosBuffer *into, IOSize n);
00024 virtual IOSize write (const void *from, IOSize n);
00025 virtual IOSize write (const void *from, IOSize n, IOOffset pos);
00026 virtual IOSize writev (const IOBuffer *from, IOSize n);
00027 virtual IOSize writev (const IOPosBuffer *from, IOSize n);
00028
00029 virtual IOOffset position (IOOffset offset, Relative whence = SET);
00030 virtual void resize (IOOffset size);
00031 virtual void flush (void);
00032 virtual void close (void);
00033
00034 private:
00035 void cache (IOOffset start, IOOffset end);
00036
00037 IOOffset image_;
00038 std::vector<char> present_;
00039 File *file_;
00040 Storage *storage_;
00041 bool closedFile_;
00042 unsigned int cacheCount_;
00043 unsigned int cacheTotal_;
00044 };
00045
00046 #endif // STORAGE_FACTORY_LOCAL_CACHE_FILE_H