diff options
Diffstat (limited to 'src/codec/proto_forst.h')
-rw-r--r-- | src/codec/proto_forst.h | 61 |
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>(); + } +}; +} +} |