3#include <score/serialization/JSONValueVisitor.hpp>
4#include <score/serialization/JSONVisitor.hpp>
6#include <ossia/detail/flat_map.hpp>
7#include <ossia/detail/hash_map.hpp>
9#include <boost/container/flat_map.hpp>
11#include <unordered_map>
15 template <
typename Map_T>
18 auto& st = s.stream();
19 st << (int32_t)obj.size();
20 for(
const auto& e : obj)
22 st << e.first << e.second;
26 template <
typename Map_T>
31 auto& st = s.stream();
34 for(int32_t i = 0; i < n; i++)
36 typename Map_T::key_type key;
37 typename Map_T::mapped_type value;
39 obj.emplace(std::move(key), std::move(value));
43 template <
typename Map_T>
46 s.stream.StartArray();
47 for(
const auto& pair : obj)
49 s.stream.StartArray();
57 template <
typename Map_T>
62 const auto& arr = s.base.GetArray();
63 for(
const auto& elt : arr)
65 const auto& pair = elt.GetArray();
66 typename Map_T::key_type key;
67 typename Map_T::mapped_type value;
70 obj.emplace(std::move(key), std::move(value));
75template <
typename T,
typename U,
typename H,
typename E,
typename A>
79template <
typename T,
typename U,
typename H,
typename E,
typename A>
84#if !defined(OSSIA_NO_FAST_CONTAINERS)
86 class Key,
class T,
class Hash,
class KeyEqual,
class AllocatorOrContainer,
87 class Bucket,
class BC,
bool IsSegmented>
89 DataStream, ankerl::unordered_dense::detail::table<
90 Key, T, Hash, KeyEqual, AllocatorOrContainer, Bucket, BC, IsSegmented>>
96 class Key,
class T,
class Hash,
class KeyEqual,
class AllocatorOrContainer,
97 class Bucket,
class BC,
bool IsSegmented>
99 JSONObject, ankerl::unordered_dense::detail::table<
100 Key, T, Hash, KeyEqual, AllocatorOrContainer, Bucket, BC, IsSegmented>>
106template <
typename T,
typename U>
109 using type = boost::container::dtl::pair<T, U>;
112 s.m_stream << obj.first << obj.second;
117 s.m_stream >> obj.first >> obj.second;
121template <
typename T,
typename U>
124 using type = boost::container::dtl::pair<T, U>;
127 s.stream.StartArray();
135 const auto& arr = s.base.GetArray();
140template <
typename T,
typename U>
143 using type = ossia::flat_map<T, U>;
144 using pair_type =
typename type::value_type;
147 s.m_stream << obj.tree().get_sequence_cref();
152 s.m_stream >> obj.tree().get_sequence_ref();
156template <
typename T,
typename U>
159 using type = ossia::flat_map<T, U>;
162 ArraySerializer::readFrom(s, obj.tree().get_sequence_cref());
167 ArraySerializer::writeTo(s, obj.tree().get_sequence_ref());
171template <
typename T,
typename U>
176template <
typename T,
typename U>
Definition VisitorInterface.hpp:53
Definition DataStreamVisitor.hpp:27
void readFrom(const score::Entity< T > &obj)
Called by code that wants to serialize.
Definition DataStreamVisitor.hpp:53
Definition DataStreamVisitor.hpp:202
Definition VisitorInterface.hpp:61
Definition JSONVisitor.hpp:52
void readFrom(const score::Entity< T > &obj)
Definition EntitySerialization.hpp:7
Definition JSONVisitor.hpp:423
Definition JSONVisitor.hpp:372
Definition MapSerialization.hpp:14
Definition VisitorInterface.hpp:13