From f40fe73cbd8f61be11721babb1e3615326466041 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 9 Nov 2023 17:02:40 +0100 Subject: codec-netcdf: Changed to memory parsing --- c++/codec-netcdf/netcdf.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'c++/codec-netcdf/netcdf.h') diff --git a/c++/codec-netcdf/netcdf.h b/c++/codec-netcdf/netcdf.h index c99217e..72e7614 100644 --- a/c++/codec-netcdf/netcdf.h +++ b/c++/codec-netcdf/netcdf.h @@ -5,6 +5,7 @@ #include #include +#include namespace saw { namespace encode { @@ -20,22 +21,23 @@ struct Netcdf {}; template class data { private: - std::string path_; + std::vector buff_; public: - data(const std::string& path): - path_{path} + data(std::vector buff): + buff_{std::move(buff)} {} - data(std::string&& path): - path_{std::move(path)} + template + data(const std::array& arr): + buff_{arr.begin(), arr.end()} {} - std::string_view get_path_view() { - return path_; + std::vector& get_data() { + return buff_; } - const std::string& get_path() const { - return path_; + const std::vector& get_data() const { + return buff_; } }; @@ -77,7 +79,7 @@ public: int ncid{}; int rc{}; - rc = nc_open(from_decode.get_path().c_str(), NC_NOWRITE, &ncid); + rc = nc_open_mem("forstio_internal_memory", NC_NOWRITE, from_decode.get_data().size(), &from_decode.get_data()[0], &ncid); if(rc != NC_NOERR){ // Don't know how to get the error, so fail critically. return make_error(); -- cgit v1.2.3