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();
50 s.readFrom(pair.first);
51 s.readFrom(pair.second);
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));
75 template <
typename T,
typename U,
typename H,
typename E,
typename A>
79 template <
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,
bool IsSegmented>
89 DataStream, ankerl::unordered_dense::detail::table<
90 Key, T, Hash, KeyEqual, AllocatorOrContainer, Bucket, IsSegmented>>
96 class Key,
class T,
class Hash,
class KeyEqual,
class AllocatorOrContainer,
97 class Bucket,
bool IsSegmented>
99 JSONObject, ankerl::unordered_dense::detail::table<
100 Key, T, Hash, KeyEqual, AllocatorOrContainer, Bucket, IsSegmented>>
106 template <
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;
121 template <
typename T,
typename U>
124 using type = boost::container::dtl::pair<T, U>;
127 s.stream.StartArray();
128 s.readFrom(obj.first);
129 s.readFrom(obj.second);
135 const auto& arr = s.base.GetArray();
140 template <
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();
156 template <
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());
171 template <
typename T,
typename U>
176 template <
typename T,
typename U>
Definition: VisitorInterface.hpp:53
Definition: DataStreamVisitor.hpp:27
Definition: DataStreamVisitor.hpp:202
Definition: VisitorInterface.hpp:61
Definition: JSONVisitor.hpp:52
Definition: JSONVisitor.hpp:423
Definition: JSONVisitor.hpp:372
Definition: MapSerialization.hpp:14
Definition: VisitorInterface.hpp:13