From e4e49a117702945066e3e279fa0f005200400cb7 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 12 Jun 2024 15:04:42 +0200 Subject: Separated Encoding and Storage approaches --- modules/codec-netcdf/c++/netcdf.hpp | 10 +++++----- modules/codec-netcdf/tests/codec-netcdf.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/codec-netcdf') diff --git a/modules/codec-netcdf/c++/netcdf.hpp b/modules/codec-netcdf/c++/netcdf.hpp index f93eceb..e89928d 100644 --- a/modules/codec-netcdf/c++/netcdf.hpp +++ b/modules/codec-netcdf/c++/netcdf.hpp @@ -19,7 +19,7 @@ struct Netcdf {}; * Class representing the files system netcdf file */ template -class data { +class data { private: std::vector buff_; public: @@ -44,7 +44,7 @@ public: }; template -class codec{ +class codec{ static_assert(always_false, "NetCDF only supports Structs as a root object"); }; @@ -53,7 +53,7 @@ class codec{ namespace saw { template -class codec...>, encode::Netcdf> { +class codec...>, encode::Netcdf, storage::Default> { private: using Schema = schema::Struct...>; public: @@ -69,7 +69,7 @@ public: * Encoder function */ template - error_or encode(const data& from, data& to) { + error_or encode(const data& from, data& to) { int rc{}; int ncid{}; @@ -131,7 +131,7 @@ public: * Decoder function */ template - error_or decode(data& from_decode, data& to_decode) { + error_or decode(data& from_decode, data& to_decode) { int ncid{}; int rc{}; diff --git a/modules/codec-netcdf/tests/codec-netcdf.cpp b/modules/codec-netcdf/tests/codec-netcdf.cpp index 0c9bc57..a47294f 100644 --- a/modules/codec-netcdf/tests/codec-netcdf.cpp +++ b/modules/codec-netcdf/tests/codec-netcdf.cpp @@ -46,7 +46,7 @@ std::array tests_data_array_nc = { SAW_TEST("NetCDF Struct Primitive write"){ using namespace saw; - data> native; + data native; native.template get<"data">().set(5); native.template get<"other">().set(32.0); @@ -69,7 +69,7 @@ SAW_TEST("NetCDF Struct Primitive read"){ using namespace saw; data netcdf{tests_data_primitive_nc}; - data> native; + data native; codec codec; @@ -84,13 +84,13 @@ SAW_TEST("NetCDF Struct Array read"){ data netcdf{tests_data_array_nc}; - data> native; + data native; codec codec; auto eov = codec.decode(netcdf, native); SAW_EXPECT(eov.is_value(), "Decoding failed"); - auto& arr = native.get<"data">(); + auto& arr = native.template get<"data">(); SAW_EXPECT(arr.get_dim_size(0) == 5, "Incorrect dimension 0"); SAW_EXPECT(arr.get_dim_size(1) == 3, "Incorrect dimension 1"); -- cgit v1.2.3