File indexing completed on 2025-01-30 10:22:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RRawFileTFile
0012 #define ROOT_RRawFileTFile
0013
0014 #include <ROOT/RRawFile.hxx>
0015
0016 #include <TFile.h>
0017
0018 #include <stdexcept>
0019
0020 namespace ROOT {
0021 namespace Internal {
0022
0023
0024
0025
0026
0027
0028
0029 class RRawFileTFile : public RRawFile {
0030 private:
0031 TFile *fFile;
0032
0033 protected:
0034 void OpenImpl() final { fOptions.fBlockSize = 0; }
0035
0036 size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final
0037 {
0038 if (fFile->ReadBuffer(static_cast<char *>(buffer), offset, nbytes)) {
0039 throw std::runtime_error("failed to read expected number of bytes");
0040 }
0041 return nbytes;
0042 }
0043
0044 std::uint64_t GetSizeImpl() final { return fFile->GetSize(); }
0045
0046 public:
0047 RRawFileTFile(TFile *file) : RRawFile(file->GetEndpointUrl()->GetFile(), {}), fFile(file) {}
0048
0049 std::unique_ptr<ROOT::Internal::RRawFile> Clone() const final { return std::make_unique<RRawFileTFile>(fFile); }
0050
0051 int GetFeatures() const final { return kFeatureHasSize; }
0052 };
0053
0054 }
0055 }
0056
0057 #endif