diff options
Diffstat (limited to 'forstio/codec/data.h')
-rw-r--r-- | forstio/codec/data.h | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/forstio/codec/data.h b/forstio/codec/data.h deleted file mode 100644 index 1682ae7..0000000 --- a/forstio/codec/data.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include <forstio/core/common.h> -#include "schema.h" - -namespace saw { -namespace encode { -struct Native {}; -} -/* - * Helper for the basic message container, so the class doesn't have to be - * specialized 10 times. - */ -template <class T> struct native_data_type; - -template <> -struct native_data_type<schema::Primitive<schema::SignedInteger, 1>> { - using type = int8_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::SignedInteger, 2>> { - using type = int16_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::SignedInteger, 4>> { - using type = int32_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::SignedInteger, 8>> { - using type = int64_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::UnsignedInteger, 1>> { - using type = uint8_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::UnsignedInteger, 2>> { - using type = uint16_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::UnsignedInteger, 4>> { - using type = uint32_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::UnsignedInteger, 8>> { - using type = uint64_t; -}; - -template <> -struct native_data_type<schema::Primitive<schema::FloatingPoint, 4>> { - using type = float; -}; - -template<typename T, typename Encoding = encode::Native> -class data { -private: - static_assert(always_false<T>, "Type not supported"); -}; - -template<> -class data<schema::String, encode::Native> { -private: - std::string value_; -public: - SAW_FORBID_COPY(data); - - data(std::string&& value__):value_{std::move(value__)}{} - - std::size_t size() const { - return value_.size(); - } - - bool operator==(const data<schema::String, encode::Native>& data){ - return value_ == data.value_; - } -}; - -template<typename T, size_t N> -class data<schema::Primitive<T,N>, encode::Native> { -private: -}; -} |