From cffe020a6fbbdbe2a716cda9ce2e9920083da530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 22 Mar 2024 10:26:15 +0100 Subject: [PATCH 1/4] added a draft for file interface --- CMakeLists.txt | 4 ++-- file_io/include/aare/FileInterface.h | 35 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 file_io/include/aare/FileInterface.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b227b2..e27be3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ else() aare_compiler_flags INTERFACE -fdiagnostics-parseable-fixits - -fdiagnostics-generate-patch + # -fdiagnostics-generate-patch -fdiagnostics-show-template-tree -fsanitize=address,undefined,pointer-compare -fno-sanitize-recover @@ -62,7 +62,7 @@ else() aare_compiler_flags INTERFACE -fdiagnostics-parseable-fixits - -fdiagnostics-generate-patch + # -fdiagnostics-generate-patch -fdiagnostics-show-template-tree -fsanitize=address,undefined,pointer-compare -fno-sanitize-recover diff --git a/file_io/include/aare/FileInterface.h b/file_io/include/aare/FileInterface.h new file mode 100644 index 0000000..3db9f6e --- /dev/null +++ b/file_io/include/aare/FileInterface.h @@ -0,0 +1,35 @@ +#pragma once +#include "aare/Frame.hpp" +#include +namespace aare { +class FileInterface { +public: + FileInterface(std::filesystem::path& fname ){}; //do we need this? + + // read the frame number on position frame_index + virtual size_t frame_number(size_t frame_index) = 0; + + // read one frame + virtual Frame read() = 0; + + // read n_frames frames + virtual std::vector read(size_t n_frames) = 0; //Is this the right interface? + + // read one frame into the provided buffer + virtual void read_into(std::byte* image_buf) = 0; + + // read n_frames frame into the provided buffer + virtual void read_into(std::byte* image_buf, size_t n_frames) = 0; + + // goto frame number + virtual void seek(size_t frame_number) = 0; + + // return the position of the file pointer (in number of frames) + virtual size_t tell() = 0; + + // total number of frames in the file + virtual size_t total_frames() = 0; + + virtual ~FileInterface() = 0; +}; +} // namespace aare From eb2b0931300ffd2c2934bff37afbfcb94701bca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 22 Mar 2024 10:33:57 +0100 Subject: [PATCH 2/4] added size and row, col --- file_io/include/aare/FileInterface.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/file_io/include/aare/FileInterface.h b/file_io/include/aare/FileInterface.h index 3db9f6e..c718c84 100644 --- a/file_io/include/aare/FileInterface.h +++ b/file_io/include/aare/FileInterface.h @@ -20,6 +20,9 @@ public: // read n_frames frame into the provided buffer virtual void read_into(std::byte* image_buf, size_t n_frames) = 0; + + // size of one frame, important fro teh read_into function + virtual size_t bytes_per_frame() const = 0; // goto frame number virtual void seek(size_t frame_number) = 0; @@ -30,6 +33,10 @@ public: // total number of frames in the file virtual size_t total_frames() = 0; + virtual size_t rows() const = 0; + + virtual size_t cols() const = 0; + virtual ~FileInterface() = 0; }; } // namespace aare From 0932869b4cfdc1e39472866952040efe50c5bc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 22 Mar 2024 10:34:57 +0100 Subject: [PATCH 3/4] added data type --- file_io/include/aare/FileInterface.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/file_io/include/aare/FileInterface.h b/file_io/include/aare/FileInterface.h index c718c84..2669942 100644 --- a/file_io/include/aare/FileInterface.h +++ b/file_io/include/aare/FileInterface.h @@ -37,6 +37,9 @@ public: virtual size_t cols() const = 0; + // function to query the data type of the file + /*virtual DataType dtype = 0; */ + virtual ~FileInterface() = 0; }; } // namespace aare From bbaeeebaefc4ad4be6c04e23476fed481e75d9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Fri, 22 Mar 2024 10:36:14 +0100 Subject: [PATCH 4/4] restored cmake --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e27be3f..0b227b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ else() aare_compiler_flags INTERFACE -fdiagnostics-parseable-fixits - # -fdiagnostics-generate-patch + -fdiagnostics-generate-patch -fdiagnostics-show-template-tree -fsanitize=address,undefined,pointer-compare -fno-sanitize-recover @@ -62,7 +62,7 @@ else() aare_compiler_flags INTERFACE -fdiagnostics-parseable-fixits - # -fdiagnostics-generate-patch + -fdiagnostics-generate-patch -fdiagnostics-show-template-tree -fsanitize=address,undefined,pointer-compare -fno-sanitize-recover