From d94c31fee53c3c7df981cf44a54dd722d7fc122c Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 15 Jan 2024 17:04:16 +0100 Subject: codec: hash functionality added --- modules/codec/c++/schema.h | 59 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'modules/codec/c++/schema.h') diff --git a/modules/codec/c++/schema.h b/modules/codec/c++/schema.h index 576f378..4549916 100644 --- a/modules/codec/c++/schema.h +++ b/modules/codec/c++/schema.h @@ -6,7 +6,9 @@ namespace saw { namespace schema { // NOLINTBEGIN -template struct Member {}; +template struct Member { + static constexpr string_literal name = "Member"; +}; template struct Struct { static_assert( @@ -15,7 +17,9 @@ template struct Struct { }; template -struct Struct...> {}; +struct Struct...> { + static constexpr string_literal name = "Struct"; +}; template struct Union { static_assert( @@ -24,13 +28,21 @@ template struct Union { }; template -struct Union...> {}; +struct Union...> { + static constexpr string_literal name = "Union"; +}; -template struct Array {}; +template struct Array { + static constexpr string_literal name = "Array"; +}; -template struct FixedArray {}; +template struct FixedArray { + static constexpr string_literal name = "FixedArray"; +}; -template struct Tuple {}; +template struct Tuple { + static constexpr string_literal name = "Tuple"; +}; /** * This acts as a separator of different encodings being mashed together @@ -43,14 +55,24 @@ template struct Tuple {}; * data ex_data; */ template -class Wrapper {}; +class Wrapper { + static constexpr string_literal name = "Wrapper"; +}; -struct String {}; +struct String { + static constexpr string_literal name = "String"; +}; -struct SignedInteger {}; -struct UnsignedInteger {}; -struct FloatingPoint {}; +struct SignedInteger { + static constexpr string_literal name = "SignedInteger"; +}; +struct UnsignedInteger { + static constexpr string_literal name = "UnsignedInteger"; +}; +struct FloatingPoint { + static constexpr string_literal name = "FloatingPoint"; +}; template struct Primitive { static_assert(((std::is_same_v || @@ -58,6 +80,7 @@ template struct Primitive { N == 4 || N == 8)) || (std::is_same_v && (N == 4 || N == 8)), "Primitive Type is not supported"); + static constexpr string_literal name = "Primitive"; }; using Int8 = Primitive; @@ -77,7 +100,9 @@ using Float64 = Primitive; * Classes allowing to distinguish Ints from VarInts */ template -struct VariableLengthPrimitive {}; +struct VariableLengthPrimitive { + static constexpr string_literal name = "VariableLengthPrimitive"; +}; using VarInt = VariableLengthPrimitive; using VarLong = VariableLengthPrimitive; @@ -86,16 +111,22 @@ using VarLong = VariableLengthPrimitive; * Classes enabling Rpc calls */ template -struct Function {}; +struct Function { + static constexpr string_literal name = "Function"; +}; template struct Interface { static_assert( always_false, "This schema template doesn't support this type of template argument"); + + static constexpr string_literal name = "Interface"; }; template -struct Interface,Names>...> {}; +struct Interface,Names>...> { + static constexpr string_literal name = "Interface"; +}; // NOLINTEND } // namespace schema -- cgit v1.2.3