TypedVariant: Be explicit about athena's Endian type

Allows this code to still compile if the Endian enum is ever changed
into an enum class.
This commit is contained in:
Lioncash 2019-09-20 17:56:13 -04:00
parent 8814ecbc4c
commit 72732a1ea7
1 changed files with 10 additions and 10 deletions

View File

@ -205,34 +205,34 @@ private:
#define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \ #define AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(...) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Read>( \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::Read>( \
typename Read::StreamT & r) { \ typename Read::StreamT & r) { \
EnumType variant_type = {}; \ EnumType variant_type = {}; \
Do<athena::io::DNA<athena::Big>::Read>(athena::io::PropId("variant_type"), variant_type, r); \ Do<athena::io::DNA<athena::Endian::Big>::Read>(athena::io::PropId("variant_type"), variant_type, r); \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
visit([&](auto& var) { var.read(r); }); \ visit([&](auto& var) { var.read(r); }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::Write>( \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::Write>( \
typename Write::StreamT & w) { \ typename Write::StreamT & w) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::Write>(athena::io::PropId("variant_type"), variant_type, w); \ Do<athena::io::DNA<athena::Endian::Big>::Write>(athena::io::PropId("variant_type"), variant_type, w); \
var.write(w); \ var.write(w); \
}); \ }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::BinarySize>( \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::BinarySize>( \
typename BinarySize::StreamT & sz) { \ typename BinarySize::StreamT & sz) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \ Do<athena::io::DNA<athena::Endian::Big>::BinarySize>(athena::io::PropId("variant_type"), variant_type, sz); \
var.binarySize(sz); \ var.binarySize(sz); \
}); \ }); \
} \ } \
@ -245,22 +245,22 @@ private:
AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \ AT_SPECIALIZE_TYPED_VARIANT_BIGDNA(__VA_ARGS__) \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::ReadYaml>( \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::ReadYaml>( \
typename ReadYaml::StreamT & r) { \ typename ReadYaml::StreamT & r) { \
EnumType variant_type = {}; \ EnumType variant_type = {}; \
Do<athena::io::DNA<athena::Big>::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \ Do<athena::io::DNA<athena::Endian::Big>::ReadYaml>(athena::io::PropId("variant_type"), variant_type, r); \
static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \ static_cast<TypedVariant<__VA_ARGS__>&>(*this) = Build(variant_type); \
visit([&](auto& var) { var.read(r); }); \ visit([&](auto& var) { var.read(r); }); \
} \ } \
\ \
template <> \ template <> \
template <> \ template <> \
inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Big>::WriteYaml>( \ inline void hecl::TypedVariantBigDNA<__VA_ARGS__>::Enumerate<athena::io::DNA<athena::Endian::Big>::WriteYaml>( \
typename WriteYaml::StreamT & w) { \ typename WriteYaml::StreamT & w) { \
visit([&](auto& var) { \ visit([&](auto& var) { \
using T = std::decay_t<decltype(var)>; \ using T = std::decay_t<decltype(var)>; \
EnumType variant_type = T::variant_type(); \ EnumType variant_type = T::variant_type(); \
Do<athena::io::DNA<athena::Big>::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \ Do<athena::io::DNA<athena::Endian::Big>::WriteYaml>(athena::io::PropId("variant_type"), variant_type, w); \
var.write(w); \ var.write(w); \
}); \ }); \
} }