31 uint8_t boolCount = 0;
32 size_t boolPopIndex = 0;
49 template <
typename... Args>
57 template <
typename Head,
typename... Tails>
58 void argsUnpack(
const Head& head,
const Tails&... tails)
const
60 const_cast<Deserializer&
>(*this).deserialize(
const_cast<Head&
>(head));
68 void argsUnpack()
const {}
71 template <
typename Bool, EnableIfNullptrT<IsBool<RemoveCVRefT<Bool>>::value> =
nullptr>
72 void deserialize(Bool& rhs)
78 template <
typename IntegralNotBool, EnableIfNullptrT<IsIntegralNotBool<RemoveCVRefT<IntegralNotBool>>::value> =
nullptr>
79 void deserialize(IntegralNotBool& rhs)
81 rhs = popArithmetic<IntegralNotBool>();
85 template <
typename FloatingPo
int, EnableIfNullptrT<IsFloatingPo
int<RemoveCVRefT<FloatingPo
int>>::value> =
nullptr>
86 void deserialize(FloatingPoint& rhs)
88 rhs = popArithmetic<Udon::Float32>();
92 template <
typename Enum, EnableIfNullptrT<IsEnum<RemoveCVRefT<Enum>>::value> =
nullptr>
93 void deserialize(Enum& rhs)
95 rhs =
static_cast<Enum
>(popArithmetic<typename std::underlying_type<Enum>::type>());
99 template <
typename Array, EnableIfNullptrT<IsArray<RemoveCVRefT<Array>>::value> =
nullptr>
100 void deserialize(Array& rhs)
102 for (
auto& element : rhs)
104 deserialize(element);
109 template <
typename Enumerable, EnableIfNullptrT<HasMemberFunctionEnumerate<RemoveCVRefT<Enumerable>>::value> =
nullptr>
110 void deserialize(Enumerable& rhs)
112 rhs.enumerate(*
this);
116 template <
typename Arithmetic>
117 Arithmetic popArithmetic()
121 constexpr auto size =
sizeof(Arithmetic);
125#if UDON_PLATFORM_ENDIANNESS == UDON_PLATFORM_LITTLE_ENDIAN
129 std::addressof(
object),
130 buffer.
data() + popIndex,
133#elif UDON_PLATFORM_ENDIANNESS == UDON_PLATFORM_BIG_ENDIAN
136 uint8_t reversedBuffer[size];
138 buffer.
cbegin() + popIndex,
139 buffer.
cbegin() + popIndex + size,
144 std::addressof(
object),
161 boolPopIndex = popIndex++;
164 const auto unpacked =
Udon::BitRead(buffer.
at(boolPopIndex), boolCount);
166 if (++boolCount >= CHAR_BIT)