#pragma once #include namespace DB { /// Delegates all reads to underlying buffer. Doesn't have own memory. class ReadBufferFromFileDecorator : public ReadBufferFromFileBase { public: explicit ReadBufferFromFileDecorator(std::unique_ptr impl_); ReadBufferFromFileDecorator(std::unique_ptr impl_, const String & file_name_); std::string getFileName() const override; off_t getPosition() override; off_t seek(off_t off, int whence) override; bool nextImpl() override; bool isWithFileSize() const { return dynamic_cast(impl.get()) != nullptr; } const ReadBuffer & getWrappedReadBuffer() const { return *impl; } ReadBuffer & getWrappedReadBuffer() { return *impl; } bool isIntegratedWithFilesystemCache() const override { return impl->isIntegratedWithFilesystemCache(); } size_t getFileSize() override; protected: std::unique_ptr impl; String file_name; }; }