summaryrefslogtreecommitdiff
path: root/src/codec/proto_forst.h
diff options
context:
space:
mode:
authorClaudius Holeksa <mail@keldu.de>2023-05-04 00:06:28 +0200
committerClaudius Holeksa <mail@keldu.de>2023-05-04 00:06:28 +0200
commit33eac9dc02024b711124ebf45bfcc9a68d8b1470 (patch)
tree44c7cf2410d60ffd5dcfbb6ed0d3ab8825a57923 /src/codec/proto_forst.h
parent2aa2af0007b7e969845642027c635cd3fd9c8aea (diff)
codec: Working on ProtoForst
Diffstat (limited to 'src/codec/proto_forst.h')
-rw-r--r--src/codec/proto_forst.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/codec/proto_forst.h b/src/codec/proto_forst.h
new file mode 100644
index 0000000..1f390fe
--- /dev/null
+++ b/src/codec/proto_forst.h
@@ -0,0 +1,61 @@
+#pragma once
+
+#include "data.h"
+
+#include <forstio/core/error.h>
+
+namespace saw {
+namespace encode {
+struct ProtoForst {};
+}
+
+template<typename Schema>
+class data<Schema, encode::ProtoForst> {
+private:
+ own<buffer> buffer_;
+public:
+ data(own<buffer>&& buffer__):buffer_{std::move(buffer__)}{}
+
+ buffer& get_buffer(){
+ return *buffer_;
+ }
+
+ const buffer& get_buffer() const {
+ return *buffer_;
+ }
+};
+namespace impl {
+template<typename T, size_t N>
+class codec<schema::Primitive<T,N>, encode::ProtoForst> {
+
+
+ static error encode(typename const data<schema::Primitive<T,N>, encode::Native>& native){
+
+ return no_error();
+ }
+
+ static uint64_t size(const data<schema::Primitive<T,N>, encode::Native>& d) {
+ return static_cast<uint64_t>(N);
+ }
+};
+}
+template<typename Schema>
+class codec<Schema, encode::ProtoForst> {
+public:
+ using meta_type = uint64_t;
+private:
+public:
+ error_or<data<Schema, encode::Native>> decode(const data<Schema, encode::ProtoForst>& encoded){
+
+
+ return make_error<err::not_implemented>();
+ }
+
+ error_or<data<Schema, encode::ProtoForst>> encode(const data<Schema, encode::Native>& native){
+ uint64_t length = 0;
+
+ return make_error<err::not_implemented>();
+ }
+};
+}
+}