33 return (a.size() == b.size() && std::strncmp(a.data(), b.data(), a.size()) == 0);
37 const std::string& definition)
38 : _global_warnings(&
std::cerr)
39 , _topic_name(topic_name)
40 , _discard_large_array(DISCARD_LARGE_ARRAYS)
41 , _max_array_size(100)
42 , _blob_policy(STORE_BLOB_AS_COPY)
66 template <
typename Container>
69 if (container.size() <= new_size)
71 const size_t increased_size = std::max(
size_t(32), container.size() * 2);
72 container.resize(increased_size);
79 deserializer->
init(buffer);
81 bool entire_message_parse =
true;
83 size_t value_index = 0;
84 size_t name_index = 0;
85 size_t blob_index = 0;
86 size_t blob_storage_index = 0;
96 bool DO_STORE = store;
97 if (
field.isConstant())
104 auto new_tree_leaf = tree_leaf;
105 new_tree_leaf.node = tree_leaf.node->child(index_s);
107 int32_t array_size =
field.arraySize();
108 if (array_size == -1)
114 new_tree_leaf.index_array.push_back(0);
117 bool IS_BLOB =
false;
133 entire_message_parse =
false;
142 if (array_size > deserializer->
bytesLeft())
144 throw std::runtime_error(
"Buffer overrun in deserializeIntoFlatContainer "
150 auto& blob = flat_container->
blob[blob_index].second;
157 auto& storage = flat_container->
blob_storage[blob_storage_index];
158 storage.resize(array_size);
159 std::memcpy(storage.data(), deserializer->
getCurrentPtr(), array_size);
160 blob_storage_index++;
169 deserializer->
jump(array_size);
173 bool DO_STORE_ARRAY = DO_STORE;
174 for (
int i = 0; i < array_size; i++)
178 DO_STORE_ARRAY =
false;
181 if (
field.isArray() && DO_STORE_ARRAY)
183 new_tree_leaf.index_array.back() = i;
196 flat_container->
name[name_index].second = str;
207 flat_container->
value[value_index] =
214 auto msg_node =
field.getMessagePtr(
_schema->msg_library);
215 deserializeImpl(msg_node.get(), new_tree_leaf, DO_STORE_ARRAY);
234 _schema->field_tree.croot()->value()->getMessagePtr(
_schema->msg_library);
236 deserializeImpl(root_msg.get(), rootnode,
true);
238 flat_container->
name.resize(name_index);
239 flat_container->
value.resize(value_index);
240 flat_container->
blob.resize(blob_index);
241 flat_container->
blob_storage.resize(blob_storage_index);
243 return entire_message_parse;