33 uint8_t boolCount = 0;
34 size_t boolInsertIndex = 0;
49 template <
typename... Args>
52 argsUnpack(std::forward<Args>(args)...);
57 template <
typename Head,
typename... Tails>
58 void argsUnpack(Head&& head, Tails&&... tails)
const
60 const_cast<Serializer&
>(*this).serialize(std::forward<Head>(head));
64 argsUnpack(std::forward<Tails>(tails)...);
68 void argsUnpack()
const {}
71 template <
typename Bool, EnableIfNullptrT<IsBool<RemoveCVRefT<Bool>>::value> =
nullptr>
72 void serialize(Bool rhs)
78 template <
typename IntegralNotBool, EnableIfNullptrT<IsIntegralNotBool<RemoveCVRefT<IntegralNotBool>>::value> =
nullptr>
79 void serialize(IntegralNotBool rhs)
85 template <
typename FloatingPo
int, EnableIfNullptrT<IsFloatingPo
int<RemoveCVRefT<FloatingPo
int>>::value> =
nullptr>
86 void serialize(FloatingPoint rhs)
88 pushArithmetic(
static_cast<Udon::Float32
>(rhs));
92 template <
typename Enum, EnableIfNullptrT<IsEnum<RemoveCVRefT<Enum>>::value> =
nullptr>
93 void serialize(Enum rhs)
95 pushArithmetic(
static_cast<typename std::underlying_type<Enum>::type
>(rhs));
99 template <
typename Array, EnableIfNullptrT<IsArray<RemoveCVRefT<Array>>::value> =
nullptr>
100 void serialize(Array&& rhs)
102 for (
auto&& element : rhs)
109 template <
typename Enumerable, EnableIfNullptrT<HasMemberFunctionEnumerate<RemoveCVRefT<Enumerable>>::value> =
nullptr>
110 void serialize(Enumerable&& rhs)
113 rhs.enumerate(*
this);
117 template <
typename Arithmetic>
118 void pushArithmetic(Arithmetic arithmetic)
120 constexpr auto size =
sizeof(Arithmetic);
124#if UDON_PLATFORM_ENDIANNESS == UDON_PLATFORM_LITTLE_ENDIAN
128 buffer.data() + pushIndex,
129 std::addressof(arithmetic),
132#elif UDON_PLATFORM_ENDIANNESS == UDON_PLATFORM_BIG_ENDIAN
135 uint8_t reversedBuffer[size];
138 std::addressof(arithmetic),
144 reversedBuffer + size,
145 buffer.begin() + pushIndex);
154 void pushBool(
bool rhs)
158 boolInsertIndex = pushIndex++;
163 if (++boolCount >= CHAR_BIT)