![]() |
![]() |
00001 #ifndef DCACHE_ADAPTOR_DCACHE_FILE_H 00002 # define DCACHE_ADAPTOR_DCACHE_FILE_H 00003 00004 # include "Utilities/StorageFactory/interface/Storage.h" 00005 # include "Utilities/StorageFactory/interface/IOFlags.h" 00006 # include <string> 00007 00008 class DCacheFile : public Storage 00009 { 00010 public: 00011 DCacheFile (void); 00012 DCacheFile (IOFD fd); 00013 DCacheFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666); 00014 DCacheFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666); 00015 ~DCacheFile (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 private: 00044 IOFD m_fd; 00045 bool m_close; 00046 std::string m_name; 00047 }; 00048 00049 #endif // DCACHE_ADAPTOR_DCACHE_FILE_H