5#include <unordered_map>
6#include <unordered_set>
17 explicit Deserializer(std::unique_ptr<Reader> reader) : reader(std::move(reader)) {}
19 bool finished()
const {
return reader->finished(); }
22 requires std::is_trivially_destructible_v<T> || std::is_same_v<std::string, T>
24 reader->read(
reinterpret_cast<uint8_t*
>(&value),
sizeof(T));
27 void read(uint8_t* data, uint64_t size) { reader->read(data, size); }
36 value = T::deserialize(*
this);
40 template<
typename T1,
typename T2>
44 values.reserve(mapSize);
45 for (
auto i = 0u; i < mapSize; i++) {
48 auto val = T2::deserialize(*
this);
49 values.emplace(key, std::move(val));
57 values.resize(vectorSize);
58 for (
auto& value : values) {
59 if constexpr (
requires(
Deserializer& deser) { T::deserialize(deser); }) {
60 value = T::deserialize(*
this);
67 template<
typename T, u
int64_t ARRAY_SIZE>
70 for (
auto& value : values) {
71 if constexpr (
requires(
Deserializer& deser) { T::deserialize(deser); }) {
72 value = T::deserialize(*
this);
83 values.resize(vectorSize);
84 for (
auto i = 0u; i < vectorSize; i++) {
85 values[i] = T::deserialize(*
this);
93 for (
auto i = 0u; i < setSize; i++) {
101 std::unique_ptr<Reader> reader;
#define KU_ASSERT(condition)
Definition assert.h:19
Definition deserializer.h:15
bool finished() const
Definition deserializer.h:19
Deserializer(std::unique_ptr< Reader > reader)
Definition deserializer.h:17
void deserializeArray(std::array< T, ARRAY_SIZE > &values)
Definition deserializer.h:68
void validateDebuggingInfo(std::string &value, std::string expectedVal)
void deserializeOptionalValue(std::unique_ptr< T > &value)
Definition deserializer.h:32
void deserializeUnorderedMap(std::unordered_map< T1, std::unique_ptr< T2 > > &values)
Definition deserializer.h:41
void read(uint8_t *data, uint64_t size)
Definition deserializer.h:27
void deserializeVectorOfPtrs(std::vector< std::unique_ptr< T > > &values)
Definition deserializer.h:80
void deserializeValue(T &value)
Definition deserializer.h:23
void deserializeUnorderedSet(std::unordered_set< T > &values)
Definition deserializer.h:90
void deserializeVector(std::vector< T > &values)
Definition deserializer.h:54
Definition alter_type.h:5