diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/async/.nix/derivation.nix | 1 | ||||
-rw-r--r-- | modules/codec-unit/.nix/derivation.nix | 1 | ||||
-rw-r--r-- | modules/codec-unit/c++/unit.hpp | 25 | ||||
-rw-r--r-- | modules/codec-unit/c++/unit.tmpl.hpp | 1 | ||||
-rw-r--r-- | modules/codec-unit/c++/unit_schema.hpp | 16 | ||||
-rw-r--r-- | modules/codec-unit/c++/unit_transform.hpp | 19 |
6 files changed, 62 insertions, 1 deletions
diff --git a/modules/async/.nix/derivation.nix b/modules/async/.nix/derivation.nix index 96bf173..502c816 100644 --- a/modules/async/.nix/derivation.nix +++ b/modules/async/.nix/derivation.nix @@ -23,6 +23,7 @@ in stdenv.mkDerivation { buildInputs = [ forstio.core forstio.codec + forstio.codec-unit ]; doCheck = true; diff --git a/modules/codec-unit/.nix/derivation.nix b/modules/codec-unit/.nix/derivation.nix index a66450e..eaba6bc 100644 --- a/modules/codec-unit/.nix/derivation.nix +++ b/modules/codec-unit/.nix/derivation.nix @@ -22,7 +22,6 @@ in stdenv.mkDerivation { buildInputs = [ forstio.core - forstio.async forstio.codec ]; diff --git a/modules/codec-unit/c++/unit.hpp b/modules/codec-unit/c++/unit.hpp new file mode 100644 index 0000000..986ca8f --- /dev/null +++ b/modules/codec-unit/c++/unit.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include "unit_schema.hpp" +#include "unit_transform.hpp" + +namespace saw { +template<typename BaseSchema, typename... Elements> +class data<schema::Unit<BaseSchema, Elements...>, encode::Native> { +public: + using Schema = schema::Unit<BaseSchema, Elements...>; +private: + data<BaseSchema, encode::Native> dat_; +public: + data() = default; + + data(data<BaseSchema, encode::Native>&& dat__): + dat_{std::move(dat__)} + {} + + data<Schema, encode::Native> operator+(const data<Schema, encode::Native>& rhs) const; + data<Schema, encode::Native> operator-(const data<Schema, encode::Native>& rhs) const; +}; +} + +#include "unit.tmpl.h" diff --git a/modules/codec-unit/c++/unit.tmpl.hpp b/modules/codec-unit/c++/unit.tmpl.hpp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/modules/codec-unit/c++/unit.tmpl.hpp @@ -0,0 +1 @@ + diff --git a/modules/codec-unit/c++/unit_schema.hpp b/modules/codec-unit/c++/unit_schema.hpp new file mode 100644 index 0000000..9ad173f --- /dev/null +++ b/modules/codec-unit/c++/unit_schema.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include <forstio/codec/schema.hpp> + +namespace saw { +namespace schema { +template<typename Unit, int64_t Exponent> +struct UnitElement {}; + +template<typename BaseSchema, typename ... Components> +struct Unit {}; + +template<typename BaseSchema> +using Scalar = Unit<BaseSchema>; +} +} diff --git a/modules/codec-unit/c++/unit_transform.hpp b/modules/codec-unit/c++/unit_transform.hpp new file mode 100644 index 0000000..6f40df5 --- /dev/null +++ b/modules/codec-unit/c++/unit_transform.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include <type_traits> +#include "unit_schema.hpp" + +namespace saw { +namespace impl { + +template<typename T, typename U> +class unit_matching; + +template<typename... T> +class unit_redux_list { + static_assert(sizeof...(T) == 0u, "Template type not supported"); + + using reduced_type = unit_redux_list<>; +}; +} +} |