diff --git a/file_io/include/aare/File.hpp b/file_io/include/aare/File.hpp index 7fc091fc..2ed9a034 100644 --- a/file_io/include/aare/File.hpp +++ b/file_io/include/aare/File.hpp @@ -1,5 +1,5 @@ #include "aare/FileInterface.hpp" -class File : public FileInterface { +class File { private: FileInterface *file_impl; @@ -10,19 +10,20 @@ class File : public FileInterface { // - a appending (appends to existing file) // TODO! do we need to support w+, r+ and a+? File(std::filesystem::path fname, std::string mode); - Frame read() override; - std::vector read(size_t n_frames) override; - void read_into(std::byte *image_buf) override; - void read_into(std::byte *image_buf, size_t n_frames) override; - size_t frame_number(size_t frame_index) override; - size_t bytes_per_frame() override; - size_t pixels() override; - void seek(size_t frame_number) override; - size_t tell() override; - size_t total_frames() const override ; - ssize_t rows() const override ; - ssize_t cols() const override ; - ssize_t bitdepth() const override ; + Frame read(); + Frame iread(size_t frame_number); + std::vector read(size_t n_frames); + void read_into(std::byte *image_buf); + void read_into(std::byte *image_buf, size_t n_frames); + size_t frame_number(size_t frame_index); + size_t bytes_per_frame(); + size_t pixels(); + void seek(size_t frame_number); + size_t tell() const; + size_t total_frames() const; + ssize_t rows() const; + ssize_t cols() const; + ssize_t bitdepth() const; File(File &&other); diff --git a/file_io/src/File.cpp b/file_io/src/File.cpp index 6e0b893e..e449bfeb 100644 --- a/file_io/src/File.cpp +++ b/file_io/src/File.cpp @@ -18,7 +18,7 @@ size_t File::frame_number(size_t frame_index) { return file_impl->frame_number(f size_t File::bytes_per_frame() { return file_impl->bytes_per_frame(); } size_t File::pixels() { return file_impl->pixels(); } void File::seek(size_t frame_number) { file_impl->seek(frame_number); } -size_t File::tell() { return file_impl->tell(); } +size_t File::tell() const{ return file_impl->tell(); } ssize_t File::rows() const { return file_impl->rows(); } ssize_t File::cols() const { return file_impl->cols(); } ssize_t File::bitdepth() const { return file_impl->bitdepth(); } @@ -26,6 +26,10 @@ File::~File() { delete file_impl; } +Frame File::iread(size_t frame_number) { + return file_impl->iread(frame_number); +} + File::File(File &&other) { file_impl = other.file_impl; other.file_impl = nullptr;