diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-04-17 15:03:09 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-04-17 15:03:09 +0200 |
commit | c1572ff1c275145208333e3e69c29c569689e51b (patch) | |
tree | 8c063016008ceac98a926bda5487794f710e3eeb | |
parent | 1a2299a70280867b93fde4050833d4bd2b419884 (diff) |
Moved to platform description in structs
-rw-r--r-- | default.nix | 6 | ||||
-rw-r--r-- | modules/codec-json/SConstruct | 1 | ||||
-rw-r--r-- | modules/codec-json/c++/json.tmpl.hpp | 6 | ||||
-rw-r--r-- | modules/codec-json/tests/codec-json.cpp | 32 | ||||
-rw-r--r-- | modules/codec-netcdf/SConstruct | 1 | ||||
-rw-r--r-- | modules/codec-netcdf/tests/codec-netcdf.cpp | 6 | ||||
-rw-r--r-- | modules/codec/SConstruct | 1 | ||||
-rw-r--r-- | modules/codec/c++/data.hpp | 88 | ||||
-rw-r--r-- | modules/codec/tests/codec.cpp | 58 | ||||
-rw-r--r-- | modules/codec/tests/csv.cpp | 2 | ||||
-rw-r--r-- | modules/core/SConstruct | 1 | ||||
-rw-r--r-- | modules/io-tls/SConstruct | 1 | ||||
-rw-r--r-- | modules/io/SConstruct | 1 | ||||
-rw-r--r-- | modules/io_codec/SConstruct | 1 |
14 files changed, 108 insertions, 97 deletions
diff --git a/default.nix b/default.nix index 2d97e9b..4315710 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { pkgs ? import <nixpkgs> {} -, stdenv ? pkgs.llvmPackages_16.stdenv -, clang-tools ? pkgs.clang-tools_16 +, stdenv ? pkgs.llvmPackages_17.stdenv +, clang-tools ? pkgs.clang-tools_17 }: let @@ -94,7 +94,6 @@ in rec { forstio.codec-netcdf forstio.io forstio.io-tls - forstio.io_codec ]; }; @@ -102,6 +101,7 @@ in rec { name = "forstio-unstable-${version}"; paths = [ forstio.remote-opencl + forstio.io_codec # forstio.codec-minecraft ]; }; diff --git a/modules/codec-json/SConstruct b/modules/codec-json/SConstruct index 20dd972..ff2b31d 100644 --- a/modules/codec-json/SConstruct +++ b/modules/codec-json/SConstruct @@ -44,6 +44,7 @@ env_vars.Add('prefix', ) env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=[ diff --git a/modules/codec-json/c++/json.tmpl.hpp b/modules/codec-json/c++/json.tmpl.hpp index e8226f9..0a9f53d 100644 --- a/modules/codec-json/c++/json.tmpl.hpp +++ b/modules/codec-json/c++/json.tmpl.hpp @@ -773,7 +773,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> { using Schema = schema::Array<T,D>; template<size_t Level> - static error_or<void> decode_flat_level(buffer_view& buff, std::vector<data<T, encode::Native>>& to, std::array<std::size_t, D>& index, std::array<std::size_t, D>& dims, bool log_dim){ + static error_or<void> decode_flat_level(buffer_view& buff, std::vector<data<T, encode::Native<rmt::Host>>>& to, std::array<std::size_t, D>& index, std::array<std::size_t, D>& dims, bool log_dim){ if constexpr (Level == D) { json_helper::skip_whitespace(buff); try { @@ -830,7 +830,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> { } template<std::size_t Level> - static error_or<void> decode_unflat_level(std::vector<data<T,encode::Native>>& flat, data<schema::Array<T,D>, ToDecode>& to, std::array<std::size_t, D>& index, std::size_t& flat_index) { + static error_or<void> decode_unflat_level(std::vector<data<T,encode::Native<rmt::Host>>>& flat, data<schema::Array<T,D>, ToDecode>& to, std::array<std::size_t, D>& index, std::size_t& flat_index) { if constexpr ( Level == D ){ auto& flat_data = flat.at(flat_index); to.at(index) = std::move(flat_data); @@ -852,7 +852,7 @@ struct json_decode<schema::Array<T,D>, ToDecode> { std::array<std::size_t, D> index; std::array<std::size_t, D> dims; std::fill(dims.begin(), dims.end(), 0); - std::vector<data<T,encode::Native>> flat_array; + std::vector<data<T,encode::Native<rmt::Host>>> flat_array; auto eov = decode_flat_level<0>(buff, flat_array, index, dims, true); if(eov.is_error()){ return eov; diff --git a/modules/codec-json/tests/codec-json.cpp b/modules/codec-json/tests/codec-json.cpp index 723e78c..aca4e21 100644 --- a/modules/codec-json/tests/codec-json.cpp +++ b/modules/codec-json/tests/codec-json.cpp @@ -28,7 +28,7 @@ using TestStruct = Struct< SAW_TEST("UInt8 write"){ using namespace saw; - data<schema::UInt8, encode::Native> native_int; + data<schema::UInt8, encode::Native<rmt::Host>> native_int; data<schema::UInt8, encode::Json> json_int; native_int.set(121); @@ -48,7 +48,7 @@ SAW_TEST("UInt8 write"){ SAW_TEST("UInt16 write"){ using namespace saw; - data<schema::UInt16, encode::Native> native_int; + data<schema::UInt16, encode::Native<rmt::Host>> native_int; data<schema::UInt16, encode::Json> json_int; native_int.set(24413); @@ -68,7 +68,7 @@ SAW_TEST("UInt16 write"){ SAW_TEST("UInt32 write"){ using namespace saw; - data<schema::UInt32, encode::Native> native_int; + data<schema::UInt32, encode::Native<rmt::Host>> native_int; data<schema::UInt32, encode::Json> json_int; native_int.set(44123); @@ -88,7 +88,7 @@ SAW_TEST("UInt32 write"){ SAW_TEST("UInt64 write"){ using namespace saw; - data<schema::UInt64, encode::Native> native_int; + data<schema::UInt64, encode::Native<rmt::Host>> native_int; data<schema::UInt64, encode::Json> json_int; native_int.set(243345543); @@ -108,7 +108,7 @@ SAW_TEST("UInt64 write"){ SAW_TEST("Int8 write"){ using namespace saw; - data<schema::Int8, encode::Native> native_int; + data<schema::Int8, encode::Native<rmt::Host>> native_int; data<schema::Int8, encode::Json> json_int; native_int.set(-121); @@ -128,7 +128,7 @@ SAW_TEST("Int8 write"){ SAW_TEST("Int16 write"){ using namespace saw; - data<schema::Int16, encode::Native> native_int; + data<schema::Int16, encode::Native<rmt::Host>> native_int; data<schema::Int16, encode::Json> json_int; native_int.set(-24413); @@ -148,7 +148,7 @@ SAW_TEST("Int16 write"){ SAW_TEST("Int32 write"){ using namespace saw; - data<schema::Int32, encode::Native> native_int; + data<schema::Int32, encode::Native<rmt::Host>> native_int; data<schema::Int32, encode::Json> json_int; native_int.set(44123); @@ -168,7 +168,7 @@ SAW_TEST("Int32 write"){ SAW_TEST("Int64 write"){ using namespace saw; - data<schema::Int64, encode::Native> native_int; + data<schema::Int64, encode::Native<rmt::Host>> native_int; data<schema::Int64, encode::Json> json_int; native_int.set(243345543); @@ -188,7 +188,7 @@ SAW_TEST("Int64 write"){ SAW_TEST("String write and read"){ using namespace saw; - data<schema::String, encode::Native> nat_str; + data<schema::String, encode::Native<rmt::Host>> nat_str; data<schema::String, encode::Json> json_str; nat_str.set("foo"); @@ -215,7 +215,7 @@ SAW_TEST("String write and read"){ SAW_TEST("Tuple read and write"){ using namespace saw; - data<schema::TestTuple, encode::Native> native_tup; + data<schema::TestTuple, encode::Native<rmt::Host>> native_tup; data<schema::TestTuple, encode::Json> json_tup; auto& nat_zero = native_tup.template get<0>(); @@ -244,7 +244,7 @@ SAW_TEST("Tuple read and write"){ SAW_TEST("Array write"){ using namespace saw; - data<schema::TestArray, encode::Native> native{3u}; + data<schema::TestArray, encode::Native<rmt::Host>> native{3u}; data<schema::TestArray, encode::Json> json; native.at(0).set("foo"); @@ -264,7 +264,7 @@ SAW_TEST("Array write"){ SAW_TEST("Three Dim Array write and read"){ using namespace saw; - data<schema::TestMultiArray, encode::Native> native{2,1,2}; + data<schema::TestMultiArray, encode::Native<rmt::Host>> native{2,1,2}; data<schema::TestMultiArray, encode::Json> json; native.at(0,0,0).set("multi"); @@ -294,7 +294,7 @@ SAW_TEST("Three Dim Array write and read"){ SAW_TEST("Struct read and write"){ using namespace saw; - data<schema::TestStruct, encode::Native> native; + data<schema::TestStruct, encode::Native<rmt::Host>> native; data<schema::TestStruct, encode::Json> json; native.get<"foo">().set(5); @@ -319,7 +319,7 @@ SAW_TEST("Struct read and write"){ SAW_TEST("Int8 read"){ using namespace saw; - data<schema::Int8, encode::Native> native_int; + data<schema::Int8, encode::Native<rmt::Host>> native_int; data<schema::Int8, encode::Json> json_int{"43"}; codec<schema::Int8, encode::Json> json_codec; @@ -337,7 +337,7 @@ SAW_TEST("Int8 read"){ SAW_TEST("Int64 read"){ using namespace saw; - data<schema::Int64, encode::Native> native_int; + data<schema::Int64, encode::Native<rmt::Host>> native_int; data<schema::Int64, encode::Json> json_int{"-453"}; codec<schema::Int64, encode::Json> json_codec; @@ -355,7 +355,7 @@ SAW_TEST("Int64 read"){ SAW_TEST("Tuple Pretty Encode and Decode"){ using namespace saw; - data<schema::TestTuple, encode::Native> native_tup; + data<schema::TestTuple, encode::Native<rmt::Host>> native_tup; data<schema::TestTuple, encode::Json> json_tup; auto& nat_zero = native_tup.template get<0>(); diff --git a/modules/codec-netcdf/SConstruct b/modules/codec-netcdf/SConstruct index 1f205d2..adabe4b 100644 --- a/modules/codec-netcdf/SConstruct +++ b/modules/codec-netcdf/SConstruct @@ -44,6 +44,7 @@ env_vars.Add('prefix', ) env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=[ diff --git a/modules/codec-netcdf/tests/codec-netcdf.cpp b/modules/codec-netcdf/tests/codec-netcdf.cpp index ef5060f..0211a15 100644 --- a/modules/codec-netcdf/tests/codec-netcdf.cpp +++ b/modules/codec-netcdf/tests/codec-netcdf.cpp @@ -46,7 +46,7 @@ std::array<uint8_t,156> tests_data_array_nc = { SAW_TEST("NetCDF Struct Primitive write"){ using namespace saw; - data<schema::TestStruct, encode::Native> native; + data<schema::TestStruct, encode::Native<rmt::Host>> native; native.get<"data">().set(5); native.get<"other">().set(32.0); @@ -69,7 +69,7 @@ SAW_TEST("NetCDF Struct Primitive read"){ using namespace saw; data<schema::TestStruct, encode::Netcdf> netcdf{tests_data_primitive_nc}; - data<schema::TestStruct, encode::Native> native; + data<schema::TestStruct, encode::Native<rmt::Host>> native; codec<schema::TestStruct, encode::Netcdf> codec; @@ -84,7 +84,7 @@ SAW_TEST("NetCDF Struct Array read"){ data<schema::TestArrayStruct, encode::Netcdf> netcdf{tests_data_array_nc}; - data<schema::TestArrayStruct, encode::Native> native; + data<schema::TestArrayStruct, encode::Native<rmt::Host>> native; codec<schema::TestArrayStruct, encode::Netcdf> codec; diff --git a/modules/codec/SConstruct b/modules/codec/SConstruct index 364f1fe..d4bc519 100644 --- a/modules/codec/SConstruct +++ b/modules/codec/SConstruct @@ -44,6 +44,7 @@ env_vars.Add('prefix', ) env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=['forstio-core'] diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 2adb5b7..7cf3e75 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -15,7 +15,11 @@ #include "schema.hpp" namespace saw { +namespace rmt { +struct Host {}; +} namespace encode { +template<typename Platform = rmt::Host> struct Native {}; } template<typename Schema, typename Encode> @@ -76,14 +80,14 @@ struct native_data_type<schema::Primitive<schema::FloatingPoint, 8>> { using type = double; }; -template<typename T, typename Encoding = encode::Native> +template<typename T, typename Encoding = encode::Native<rmt::Host>> class data { private: static_assert(always_false<T>, "Type not supported"); }; template<typename T, size_t N> -class data<schema::Primitive<T,N>, encode::Native> { +class data<schema::Primitive<T,N>, encode::Native<rmt::Host>> { private: typename native_data_type<schema::Primitive<T,N>>::type value_; public: @@ -101,19 +105,19 @@ public: typename native_data_type<schema::Primitive<T,N>>::type get() const {return value_;} - data<schema::Primitive<T,N>, encode::Native> operator*(const data<schema::Primitive<T,N>, encode::Native>& rhs)const{ + data<schema::Primitive<T,N>, encode::Native<rmt::Host>> operator*(const data<schema::Primitive<T,N>, encode::Native<rmt::Host>>& rhs)const{ return {get() * rhs.get()}; } - data<schema::Primitive<T,N>, encode::Native> operator/(const data<schema::Primitive<T,N>, encode::Native>& rhs)const{ + data<schema::Primitive<T,N>, encode::Native<rmt::Host>> operator/(const data<schema::Primitive<T,N>, encode::Native<rmt::Host>>& rhs)const{ return {get() / rhs.get()}; } - data<schema::Primitive<T,N>, encode::Native> operator+(const data<schema::Primitive<T,N>, encode::Native>& rhs)const{ + data<schema::Primitive<T,N>, encode::Native<rmt::Host>> operator+(const data<schema::Primitive<T,N>, encode::Native<rmt::Host>>& rhs)const{ return {get() + rhs.get()}; } - data<schema::Primitive<T,N>, encode::Native> operator-(const data<schema::Primitive<T,N>, encode::Native>& rhs)const{ + data<schema::Primitive<T,N>, encode::Native<rmt::Host>> operator-(const data<schema::Primitive<T,N>, encode::Native<rmt::Host>>& rhs)const{ return {get() - rhs.get()}; } @@ -131,18 +135,18 @@ public: * Casts */ template<typename Target> - data<Target, encode::Native> cast_to(){ + data<Target, encode::Native<rmt::Host>> cast_to(){ auto raw_to = static_cast<typename saw::native_data_type<Target>::type>(value_); return {raw_to}; } }; template<typename TA, uint64_t NA, typename TB, uint64_t NB> -class data<schema::MixedPrecision<schema::Primitive<TA,NA>, schema::Primitive<TB,NB>>, encode::Native>{ +class data<schema::MixedPrecision<schema::Primitive<TA,NA>, schema::Primitive<TB,NB>>, encode::Native<rmt::Host>>{ public: using Schema = schema::MixedPrecision<schema::Primitive<TA,NA>, schema::Primitive<TB,NB>>; private: - data<typename Schema::StorageSchema, encode::Native> value_; + data<typename Schema::StorageSchema, encode::Native<rmt::Host>> value_; public: data():value_{}{} @@ -158,9 +162,9 @@ public: }; template<typename... T, string_literal... literals> -class data<schema::Union<schema::Member<T, literals>...>, encode::Native> { +class data<schema::Union<schema::Member<T, literals>...>, encode::Native<rmt::Host>> { private: - std::variant<data<T,encode::Native>...> value_; + std::variant<data<T,encode::Native<rmt::Host>>...> value_; public: data() = default; @@ -168,12 +172,12 @@ public: SAW_DEFAULT_MOVE(data); template<string_literal lit> - void set(data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native> val){ + void set(data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native<rmt::Host>> val){ value_ = std::move(val); } template<string_literal lit> - data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native>& init(){ + data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native<rmt::Host>>& init(){ value_.template emplace<parameter_key_pack_index<lit, literals...>::value>(); return get<lit>(); } @@ -184,20 +188,20 @@ public: } template<string_literal lit> - data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native>& get(){ + data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native<rmt::Host>>& get(){ return std::get<parameter_key_pack_index<lit, literals...>::value>(value_); } template<string_literal lit> - const data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native>& get() const{ + const data<typename parameter_pack_type<parameter_key_pack_index<lit, literals...>::value, T...>::type, encode::Native<rmt::Host>>& get() const{ return std::get<parameter_key_pack_index<lit, literals...>::value>(value_); } }; template<typename... T, string_literal... literals> -class data<schema::Struct<schema::Member<T, literals>...>, encode::Native> { +class data<schema::Struct<schema::Member<T, literals>...>, encode::Native<rmt::Host>> { private: - std::tuple<data<T,encode::Native>...> value_; + std::tuple<data<T,encode::Native<rmt::Host>>...> value_; public: data() = default; SAW_DEFAULT_COPY(data); @@ -210,7 +214,7 @@ public: literal, literals... >::value , T...>::type - , encode::Native>& get(){ + , encode::Native<rmt::Host>>& get(){ return std::get<parameter_key_pack_index<literal, literals...>::value>(value_); } @@ -221,7 +225,7 @@ public: literal, literals... >::value , T...>::type - , encode::Native>& get() const { + , encode::Native<rmt::Host>>& get() const { return std::get<parameter_key_pack_index<literal, literals...>::value>(value_); } @@ -231,21 +235,21 @@ public: }; template<typename... T> -class data<schema::Tuple<T...>, encode::Native> { +class data<schema::Tuple<T...>, encode::Native<rmt::Host>> { private: - std::tuple<data<T,encode::Native>...> value_; + std::tuple<data<T,encode::Native<rmt::Host>>...> value_; public: data() = default; SAW_DEFAULT_COPY(data); SAW_DEFAULT_MOVE(data); template<size_t i> - data<typename parameter_pack_type<i,T...>::type, encode::Native>& get(){ + data<typename parameter_pack_type<i,T...>::type, encode::Native<rmt::Host>>& get(){ return std::get<i>(value_); } template<size_t i> - const data<typename parameter_pack_type<i,T...>::type, encode::Native>& get() const{ + const data<typename parameter_pack_type<i,T...>::type, encode::Native<rmt::Host>>& get() const{ return std::get<i>(value_); } @@ -255,11 +259,11 @@ public: }; template<typename T, size_t Dim> -class data<schema::Array<T,Dim>, encode::Native> { +class data<schema::Array<T,Dim>, encode::Native<rmt::Host>> { private: // data<schema::FixedArray<schema::UInt64, Dim>> dims_; std::array<uint64_t, Dim> dims_; - std::vector<data<T, encode::Native>> value_; + std::vector<data<T, encode::Native<rmt::Host>>> value_; uint64_t get_full_size() const { uint64_t s = 1; @@ -291,7 +295,7 @@ class data<schema::Array<T,Dim>, encode::Native> { } template<size_t i = 0> - error_or<void> add(saw::data<T,encode::Native> data){ + error_or<void> add(saw::data<T,encode::Native<rmt::Host>> data){ /** @todo * Generally the last dimension can always accept a element so to say. * Changing the others would require moving data due to the stride changing. @@ -326,29 +330,29 @@ class data<schema::Array<T,Dim>, encode::Native> { static_assert(sizeof...(Dims)==Dim, "Argument size must be equal to the Dimension"); } - data<T, encode::Native>& at(const std::array<uint64_t, Dim>& ind){ + data<T, encode::Native<rmt::Host>>& at(const std::array<uint64_t, Dim>& ind){ return value_.at(this->get_flat_index(ind)); } - const data<T, encode::Native>& at(const std::array<uint64_t, Dim>& ind) const { + const data<T, encode::Native<rmt::Host>>& at(const std::array<uint64_t, Dim>& ind) const { return value_.at(this->get_flat_index(ind)); } template<std::integral... Dims> - data<T, encode::Native>& at(Dims... i){ + data<T, encode::Native<rmt::Host>>& at(Dims... i){ return value_.at(this->get_flat_index(std::array<uint64_t, Dim>{static_cast<uint64_t>(i)...})); } template<std::integral... Dims> - const data<T, encode::Native>& at(Dims... i) const { + const data<T, encode::Native<rmt::Host>>& at(Dims... i) const { return value_.at(this->get_flat_index(std::array<uint64_t, Dim>{static_cast<uint64_t>(i)...})); } - data<T,encode::Native>& at(const data<schema::FixedArray<schema::UInt64,Dim>>& i){ + data<T,encode::Native<rmt::Host>>& at(const data<schema::FixedArray<schema::UInt64,Dim>>& i){ return value_.at(this->get_flat_index(i)); } - const data<T,encode::Native>& at(const data<schema::FixedArray<schema::UInt64,Dim>>& i)const{ + const data<T,encode::Native<rmt::Host>>& at(const data<schema::FixedArray<schema::UInt64,Dim>>& i)const{ return value_.at(this->get_flat_index(i)); } @@ -396,39 +400,39 @@ private: }; template<typename T, uint64_t... D> -class data<schema::FixedArray<T,D...>, encode::Native> { +class data<schema::FixedArray<T,D...>, encode::Native<rmt::Host>> { private: - //using inner_type = std::array<data<T, encode::Native>, multiply_helper<Dims...>::value>; + //using inner_type = std::array<data<T, encode::Native<rmt::Host>>, multiply_helper<Dims...>::value>; //std::unique_ptr<inner_type> value_; - using ArrayT = std::array<data<T, encode::Native>, ct_multiply<uint64_t, D...>::value>; + using ArrayT = std::array<data<T, encode::Native<rmt::Host>>, ct_multiply<uint64_t, D...>::value>; ArrayT value_; public: data() = default; - data<T, encode::Native>& at(const std::array<uint64_t, sizeof...(D)>& ind){ + data<T, encode::Native<rmt::Host>>& at(const std::array<uint64_t, sizeof...(D)>& ind){ return value_.at(this->get_flat_index(ind)); } - const data<T, encode::Native>& at(const std::array<uint64_t, sizeof...(D)>& ind) const { + const data<T, encode::Native<rmt::Host>>& at(const std::array<uint64_t, sizeof...(D)>& ind) const { return value_.at(this->get_flat_index(ind)); } template<std::integral... Dims> - data<T, encode::Native>& at(Dims... i) { + data<T, encode::Native<rmt::Host>>& at(Dims... i) { return value_.at(this->get_flat_index({i...})); } template<std::integral... Dims> - const data<T, encode::Native>& at(Dims... i) const { + const data<T, encode::Native<rmt::Host>>& at(Dims... i) const { return value_.at(this->get_flat_index({i...})); } - data<T, encode::Native>& at(const data<schema::FixedArray<schema::UInt64, sizeof...(D)>>& i){ + data<T, encode::Native<rmt::Host>>& at(const data<schema::FixedArray<schema::UInt64, sizeof...(D)>>& i){ return value_.at(this->get_flat_index(i)); } - const data<T, encode::Native>& at(const data<schema::FixedArray<schema::UInt64, sizeof...(D)>>& i)const{ + const data<T, encode::Native<rmt::Host>>& at(const data<schema::FixedArray<schema::UInt64, sizeof...(D)>>& i)const{ return value_.at(this->get_flat_index(i)); } @@ -459,7 +463,7 @@ private: }; template<> -class data<schema::String, encode::Native> { +class data<schema::String, encode::Native<rmt::Host>> { private: std::string value_; public: diff --git a/modules/codec/tests/codec.cpp b/modules/codec/tests/codec.cpp index 7113d45..8ffe9f0 100644 --- a/modules/codec/tests/codec.cpp +++ b/modules/codec/tests/codec.cpp @@ -50,7 +50,7 @@ using TestInterface = Interface< SAW_TEST("One Dimensional Array") { using namespace saw; - data<schema::OneDimArray, encode::Native> arr{500u}; + data<schema::OneDimArray, encode::Native<rmt::Host>> arr{500u}; int bar = 0; @@ -69,7 +69,7 @@ SAW_TEST("One Dimensional Array") { SAW_TEST("One dim Array Default init"){ using namespace saw; - data<schema::OneDimArray, encode::Native> arr; + data<schema::OneDimArray, encode::Native<rmt::Host>> arr; SAW_EXPECT(arr.get_dim_size(0) == 0, "Dim should be size 0"); SAW_EXPECT(arr.size() == 0, "Total size should also be zero"); @@ -78,7 +78,7 @@ SAW_TEST("One dim Array Default init"){ SAW_TEST("One dimensional Array Add"){ using namespace saw; - data<schema::OneDimArray, encode::Native> arr{5u}; + data<schema::OneDimArray, encode::Native<rmt::Host>> arr{5u}; int bar = 0; @@ -95,7 +95,7 @@ SAW_TEST("One dimensional Array Add"){ SAW_TEST("Two Dimensional Array") { using namespace saw; - data<schema::TwoDimArray, encode::Native> arr{10,30u}; + data<schema::TwoDimArray, encode::Native<rmt::Host>> arr{10,30u}; int expected_sum = (300 * 301) / 2; @@ -119,7 +119,7 @@ SAW_TEST("Two Dimensional Array") { SAW_TEST("Three Dimensional Array") { using namespace saw; - data<schema::ThreeDimArray, encode::Native> arr{10,10u,3}; + data<schema::ThreeDimArray, encode::Native<rmt::Host>> arr{10,10u,3}; int expected_sum = (300 * 301) / 2; int bar = 0; @@ -145,7 +145,7 @@ SAW_TEST("Three Dimensional Array") { SAW_TEST("KelSimple UInt16 write"){ using namespace saw; - data<schema::UInt16, encode::Native> native; + data<schema::UInt16, encode::Native<rmt::Host>> native; data<schema::UInt16, encode::KelSimple> simple; codec<schema::UInt16, encode::KelSimple> codec; @@ -168,7 +168,7 @@ SAW_TEST("KelSimple UInt16 write"){ SAW_TEST("KelSimple UInt32 write"){ using namespace saw; - data<schema::UInt32, encode::Native> native; + data<schema::UInt32, encode::Native<rmt::Host>> native; data<schema::UInt32, encode::KelSimple> simple; codec<schema::UInt32, encode::KelSimple> codec; @@ -191,7 +191,7 @@ SAW_TEST("KelSimple UInt32 write"){ SAW_TEST("KelSimple Array write and read back"){ using namespace saw; - data<schema::TwoDimArray, encode::Native> native{2,3}; + data<schema::TwoDimArray, encode::Native<rmt::Host>> native{2,3}; data<schema::TwoDimArray, encode::KelSimple> simple; codec<schema::TwoDimArray, encode::KelSimple> codec; @@ -224,7 +224,7 @@ SAW_TEST("KelSimple Array write and read back"){ SAW_TEST("KelSimple Struct write and read back"){ using namespace saw; - data<schema::TestStruct,encode::Native> native; + data<schema::TestStruct,encode::Native<rmt::Host>> native; data<schema::TestStruct,encode::KelSimple> simple; auto& tda = native.template get<"two_dim_array">(); @@ -255,7 +255,7 @@ SAW_TEST("KelSimple Struct write and read back"){ SAW_TEST("Native Union same type compilation"){ using namespace saw; - data<schema::TestSameTypeUnion, encode::Native> native; + data<schema::TestSameTypeUnion, encode::Native<rmt::Host>> native; native.template init<"two">().set(50u); @@ -268,10 +268,10 @@ SAW_TEST("Native Union same type compilation"){ SAW_TEST("KelSimple Union write and read back"){ using namespace saw; - data<schema::TestUnion,encode::Native> native; + data<schema::TestUnion,encode::Native<rmt::Host>> native; data<schema::TestUnion,encode::KelSimple> simple; - native.template set<"number">(data<schema::UInt64, encode::Native>{}); + native.template set<"number">(data<schema::UInt64, encode::Native<rmt::Host>>{}); native.template get<"number">().set(410); codec<schema::TestUnion, encode::KelSimple> codec; @@ -292,7 +292,7 @@ SAW_TEST("KelSimple Union write and read back"){ SAW_TEST("KelSimple Tuple write and read back"){ using namespace saw; - data<schema::TestTuple,encode::Native> native; + data<schema::TestTuple,encode::Native<rmt::Host>> native; data<schema::TestTuple,encode::KelSimple> simple; auto& tda = native.template get<0>(); @@ -323,7 +323,7 @@ SAW_TEST("KelSimple Tuple write and read back"){ SAW_TEST("KelSimple String write and read back"){ using namespace saw; - data<schema::String,encode::Native> native; + data<schema::String,encode::Native<rmt::Host>> native; data<schema::String,encode::KelSimple> simple; std::string str = "FooBananaJoe"; @@ -348,14 +348,14 @@ SAW_TEST("Function basics"){ using namespace saw; { - data<schema::TestInt32Pair, encode::Native> native; + data<schema::TestInt32Pair, encode::Native<rmt::Host>> native; native.get<0>().set(5); native.get<1>().set(40); - auto func_add = function_factory<schema::TestCalcFunction, encode::Native>::create( - [](data<schema::TestInt32Pair, encode::Native> req){ - data<schema::Int32, encode::Native> resp; + auto func_add = function_factory<schema::TestCalcFunction, encode::Native<rmt::Host>>::create( + [](data<schema::TestInt32Pair, encode::Native<rmt::Host>> req){ + data<schema::Int32, encode::Native<rmt::Host>> resp; resp.set(req.get<0>().get() + req.get<1>().get()); @@ -374,36 +374,36 @@ SAW_TEST("Function basics"){ SAW_TEST("Interface basics"){ using namespace saw; - data<schema::TestInt32Pair, encode::Native> native; + data<schema::TestInt32Pair, encode::Native<rmt::Host>> native; auto func_add = - [](data<schema::TestInt32Pair, encode::Native> req){ - data<schema::Int32, encode::Native> resp; + [](data<schema::TestInt32Pair, encode::Native<rmt::Host>> req){ + data<schema::Int32, encode::Native<rmt::Host>> resp; resp.set(req.get<0>().get() + req.get<1>().get()); return resp; }; auto func_sub = - [](data<schema::TestInt32Pair, encode::Native> req){ - data<schema::Int32, encode::Native> resp; + [](data<schema::TestInt32Pair, encode::Native<rmt::Host>> req){ + data<schema::Int32, encode::Native<rmt::Host>> resp; resp.set(req.get<0>().get() - req.get<1>().get()); return resp; }; - auto func_multiply = [](data<schema::TestInt32Pair, encode::Native> req){ - data<schema::Int32, encode::Native> resp; + auto func_multiply = [](data<schema::TestInt32Pair, encode::Native<rmt::Host>> req){ + data<schema::Int32, encode::Native<rmt::Host>> resp; resp.set(req.get<0>().get() * req.get<1>().get()); return resp; }; - auto iface = interface_factory<schema::TestInterface, encode::Native>::create(std::move(func_add), std::move(func_sub), std::move(func_multiply)); + auto iface = interface_factory<schema::TestInterface, encode::Native<rmt::Host>>::create(std::move(func_add), std::move(func_sub), std::move(func_multiply)); { - data<schema::TestInt32Pair, encode::Native> native; + data<schema::TestInt32Pair, encode::Native<rmt::Host>> native; native.get<0>().set(5); native.get<1>().set(40); @@ -414,7 +414,7 @@ SAW_TEST("Interface basics"){ SAW_EXPECT(val.get() == 45, "Sum is incorrect"); } { - data<schema::TestInt32Pair, encode::Native> native; + data<schema::TestInt32Pair, encode::Native<rmt::Host>> native; native.get<0>().set(5); native.get<1>().set(40); @@ -425,7 +425,7 @@ SAW_TEST("Interface basics"){ SAW_EXPECT(val.get() == -35, "Sum is incorrect"); } { - data<schema::TestInt32Pair, encode::Native> native; + data<schema::TestInt32Pair, encode::Native<rmt::Host>> native; native.get<0>().set(5); native.get<1>().set(40); diff --git a/modules/codec/tests/csv.cpp b/modules/codec/tests/csv.cpp index ac394ce..6e9b124 100644 --- a/modules/codec/tests/csv.cpp +++ b/modules/codec/tests/csv.cpp @@ -22,7 +22,7 @@ SAW_TEST("Codec Csv Encode Basic"){ using namespace saw; size_t n_size = 3; - data <TestArray, encode::Native> native_data{n_size}; + data <TestArray, encode::Native<rmt::Host>> native_data{n_size}; { auto& row = native_data.at(0); row.template get<"string">().set("foo"); diff --git a/modules/core/SConstruct b/modules/core/SConstruct index 643550d..e831b26 100644 --- a/modules/core/SConstruct +++ b/modules/core/SConstruct @@ -44,6 +44,7 @@ env_vars.Add('prefix', ) env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=[]) diff --git a/modules/io-tls/SConstruct b/modules/io-tls/SConstruct index fbd8657..5101537 100644 --- a/modules/io-tls/SConstruct +++ b/modules/io-tls/SConstruct @@ -44,6 +44,7 @@ env_vars.Add('prefix', ) env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=['gnutls','forstio-io']) diff --git a/modules/io/SConstruct b/modules/io/SConstruct index 3eedb77..adf0df9 100644 --- a/modules/io/SConstruct +++ b/modules/io/SConstruct @@ -51,6 +51,7 @@ env_vars.Add( ); env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX = ['c++'], CPPDEFINES=[ 'SAW_UNIX' ], diff --git a/modules/io_codec/SConstruct b/modules/io_codec/SConstruct index 7d0fb6f..b1ea13d 100644 --- a/modules/io_codec/SConstruct +++ b/modules/io_codec/SConstruct @@ -51,6 +51,7 @@ env_vars.Add('prefix', ); env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[], + CXX=['c++'], CPPDEFINES=['SAW_UNIX'], CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], LIBS=[ |