00001 #ifndef XRD_ADAPTOR_XRD_FILE_H 00002 # define XRD_ADAPTOR_XRD_FILE_H 00003 00004 # include "Utilities/StorageFactory/interface/Storage.h" 00005 # include "Utilities/StorageFactory/interface/IOFlags.h" 00006 # include "XrdClient/XrdClient.hh" 00007 # include <string> 00008 00009 class XrdFile : public Storage 00010 { 00011 public: 00012 XrdFile (void); 00013 XrdFile (IOFD fd); 00014 XrdFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666); 00015 XrdFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666); 00016 ~XrdFile (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 bool prefetch (const IOPosBuffer *what, IOSize n); 00037 virtual IOSize read (void *into, IOSize n); 00038 virtual IOSize read (void *into, IOSize n, IOOffset pos); 00039 virtual IOSize readv (IOBuffer *into, IOSize n); 00040 virtual IOSize readv (IOPosBuffer *into, IOSize n); 00041 virtual IOSize write (const void *from, IOSize n); 00042 virtual IOSize write (const void *from, IOSize n, IOOffset pos); 00043 00044 virtual IOOffset position (IOOffset offset, Relative whence = SET); 00045 virtual void resize (IOOffset size); 00046 00047 virtual void close (void); 00048 virtual void abort (void); 00049 00050 private: 00051 XrdClient *m_client; 00052 IOOffset m_offset; 00053 XrdClientStatInfo m_stat; 00054 bool m_close; 00055 std::string m_name; 00056 }; 00057 00058 #endif // XRD_ADAPTOR_XRD_FILE_H