moving m_fname into respective class

This commit is contained in:
Erik Frojdh
2024-04-02 14:32:04 +02:00
parent e534cc0f25
commit 9854500a6f
5 changed files with 25 additions and 17 deletions

View File

@ -9,7 +9,7 @@ public:
// - w writing (overwrites existing file)
// - a appending (appends to existing file)
// TODO! do we need to support w+, r+ and a+?
FileInterface(std::filesystem::path& fname, const char* opts="r" ){};
FileInterface(const std::filesystem::path& fname, const char* opts="r" ){};
// write one frame
virtual void write(Frame& frame) = 0;

View File

@ -83,7 +83,7 @@ class FileInterface {
public:
std::string mode;
std::filesystem::path m_fname;
// std::filesystem::path m_fname;
std::filesystem::path m_base_path;
std::string m_base_name, m_ext;
int m_findex;

View File

@ -4,15 +4,21 @@
#include "aare/defs.hpp"
#include <iostream>
#include <numeric>
#include <filesystem>
namespace aare{
class NumpyFile : public FileInterface {
FILE *fp = nullptr;
size_t initial_header_len = 0;
public:
std::filesystem::path m_fname; //TO be made private!
NumpyFile(const std::filesystem::path& fname);
NumpyFile(FileConfig, header_t);
void write(Frame &frame) override;
Frame read() override { return get_frame(this->current_frame++); }
@ -29,8 +35,6 @@ class NumpyFile : public FileInterface {
ssize_t cols() const override { return header.shape[2]; }
ssize_t bitdepth() const override { return header.dtype.bitdepth(); }
NumpyFile(std::filesystem::path fname);
NumpyFile(FileConfig, header_t);
header_t header;
uint8_t major_ver_{};
uint8_t minor_ver_{};

View File

@ -9,8 +9,10 @@ namespace aare {
class RawFile : public FileInterface {
using config = RawFileConfig;
public:
std::filesystem::path m_fname; //TO be made private!
void write(Frame &frame) override{};
Frame read() override { return get_frame(this->current_frame++); };
std::vector<Frame> read(size_t n_frames) override;