| 997 | template <typename MapType, typename StructT, size_t Index, int8_t KeyNode, |
| 998 | int8_t ValueNode> |
| 999 | void write_configured_map_data(const MapType &map, WriteContext &ctx) { |
| 1000 | using Key = key_type_t<MapType>; |
| 1001 | using Value = mapped_type_t<MapType>; |
| 1002 | ctx.write_var_uint32(static_cast<uint32_t>(map.size())); |
| 1003 | if (map.empty()) { |
| 1004 | return; |
| 1005 | } |
| 1006 | size_t header_offset = 0; |
| 1007 | uint8_t pair_counter = 0; |
| 1008 | bool need_write_header = true; |
| 1009 | for (const auto &[key, value] : map) { |
| 1010 | if (need_write_header) { |
| 1011 | ctx.enter_flush_barrier(); |
| 1012 | header_offset = ctx.buffer().writer_index(); |
| 1013 | ctx.write_uint16(0); |
| 1014 | ctx.buffer().unsafe_put_byte( |
| 1015 | header_offset, static_cast<uint8_t>(DECL_KEY_TYPE | DECL_VALUE_TYPE)); |
| 1016 | need_write_header = false; |
| 1017 | } |
| 1018 | if constexpr (KeyNode >= 0) { |
| 1019 | write_configured_value<Key, StructT, Index, KeyNode>( |
| 1020 | key, ctx, RefMode::None, false, true); |
| 1021 | } else { |
| 1022 | Serializer<Key>::write_data(key, ctx); |
| 1023 | } |
| 1024 | if constexpr (ValueNode >= 0) { |
| 1025 | write_configured_value<Value, StructT, Index, ValueNode>( |
| 1026 | value, ctx, RefMode::None, false, true); |
| 1027 | } else { |
| 1028 | Serializer<Value>::write_data(value, ctx); |
| 1029 | } |
| 1030 | ++pair_counter; |
| 1031 | if (pair_counter == MAX_CHUNK_SIZE) { |
| 1032 | write_chunk_size(ctx, header_offset, pair_counter); |
| 1033 | ctx.exit_flush_barrier(); |
| 1034 | ctx.try_flush(); |
| 1035 | pair_counter = 0; |
| 1036 | need_write_header = true; |
| 1037 | } |
| 1038 | } |
| 1039 | if (pair_counter > 0) { |
| 1040 | write_chunk_size(ctx, header_offset, pair_counter); |
| 1041 | ctx.exit_flush_barrier(); |
| 1042 | ctx.try_flush(); |
| 1043 | } |
| 1044 | } |
| 1045 | |
| 1046 | template <typename MapType, typename StructT, size_t Index, int8_t KeyNode, |
| 1047 | int8_t ValueNode> |
nothing calls this directly
no test coverage detected