summaryrefslogtreecommitdiff
path: root/modules/codec-unit/c++
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec-unit/c++')
-rw-r--r--modules/codec-unit/c++/unit.hpp25
-rw-r--r--modules/codec-unit/c++/unit.tmpl.hpp1
-rw-r--r--modules/codec-unit/c++/unit_schema.hpp16
-rw-r--r--modules/codec-unit/c++/unit_transform.hpp19
4 files changed, 61 insertions, 0 deletions
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<>;
+};
+}
+}