diff options
Diffstat (limited to 'modules/codec/c++/forst.hpp')
-rw-r--r-- | modules/codec/c++/forst.hpp | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/modules/codec/c++/forst.hpp b/modules/codec/c++/forst.hpp index 0e200cb..16f55c9 100644 --- a/modules/codec/c++/forst.hpp +++ b/modules/codec/c++/forst.hpp @@ -1,7 +1,10 @@ #pragma once +#include <forstio/buffer.hpp> + #include "data.hpp" + namespace saw { namespace encode { struct KelForst {}; @@ -11,6 +14,7 @@ struct KelForst {}; #include "forst.tmpl.hpp" namespace saw { +template <> class data<schema::String, encode::KelForst> { private: own<buffer> buff_; @@ -20,13 +24,71 @@ public: {} }; +template<typename T, uint64_t N> +class data<schema::Primitive<T,N>, encode::KelForst> { +public: + using Schema = schema::Primitive<T,N>; +private: + our<buffer> buff_; + uint64_t displacement_; +public: + /** + * Constructor for root elements + */ + data(our<buffer> buff): + buff_{std::move(buff)}, + displacement_{0u} + {} + + /** + * Constructor for child elements + */ + data(our<buffer> buff, uint64_t dsp): + buff_{std::move(buff)}, + displacement_{dsp} + {} + + /** + * Get values + */ + typename native_data_type<Schema>::type get(){ + return {}; + } + + /** + * Set values + */ + void set(typename native_data_type<Schema>::type val){ + (void) val; + } +}; + template<typename... T, string_literal... Keys> class data<schema::Struct<schema::Member<T,Keys>...>, encode::KelForst> { private: - own<buffer> buff_; + /** + * Buffer holding the whole packet + */ + our<buffer> buff_; + /** + * Displacement to show the starting point + */ + uint64_t displacement_; public: - data(own<buffer> buff): - buff_{std::move(buff)} + /** + * Constructor for root elements + */ + data(our<buffer> buff): + buff_{std::move(buff)}, + displacement_{0u} + {} + + /** + * Constructor for child elements + */ + data(our<buffer> buff, uint64_t dsp): + buff_{std::move(buff)}, + displacement_{dsp} {} }; } |