2022-12-19 14:37:51 +00:00
|
|
|
[info]
|
2023-05-23 22:26:38 +01:00
|
|
|
type_name = "folly::sorted_vector_set"
|
2022-12-19 14:37:51 +00:00
|
|
|
header = "folly/sorted_vector_types.h"
|
2023-08-16 20:40:36 +01:00
|
|
|
ctype = "SORTED_VEC_SET_TYPE"
|
2023-05-23 22:26:38 +01:00
|
|
|
stub_template_params = [1,2]
|
|
|
|
underlying_container_index = 4
|
|
|
|
|
|
|
|
# Old
|
|
|
|
typeName = "folly::sorted_vector_set<"
|
2022-12-19 14:37:51 +00:00
|
|
|
ns = ["namespace std", "folly::sorted_vector_set"]
|
2023-02-08 14:34:14 +00:00
|
|
|
replaceTemplateParamIndex = [1,2]
|
|
|
|
underlyingContainerIndex = 4
|
2022-12-19 14:37:51 +00:00
|
|
|
|
|
|
|
[codegen]
|
|
|
|
decl = """
|
|
|
|
template <class T, class Compare, class Allocator, class GrowthPolicy, class Container>
|
|
|
|
void getSizeType(const %1%<T,Compare, Allocator, GrowthPolicy, Container> &container, size_t& returnArg);
|
|
|
|
"""
|
|
|
|
|
|
|
|
func = """
|
|
|
|
template <class T, class Compare, class Allocator, class GrowthPolicy, class Container>
|
2023-02-23 23:32:37 +00:00
|
|
|
void getSizeType(const %1%<T,Compare, Allocator, GrowthPolicy, Container> &containerAdapter, size_t& returnArg)
|
2022-12-19 14:37:51 +00:00
|
|
|
{
|
2023-02-23 23:32:37 +00:00
|
|
|
SAVE_DATA((uintptr_t)&containerAdapter);
|
2022-12-19 14:37:51 +00:00
|
|
|
|
2023-02-23 23:32:37 +00:00
|
|
|
// Underlying container is grabbed by recursion, store only the exclusive size.
|
|
|
|
SAVE_SIZE(sizeof(%1%<T,Compare, Allocator, GrowthPolicy, Container>) - sizeof(Container));
|
2022-12-19 14:37:51 +00:00
|
|
|
|
2023-02-23 23:32:37 +00:00
|
|
|
const Container &container = containerAdapter.get_container();
|
|
|
|
getSizeType(container, returnArg);
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
"""
|
2023-04-20 17:52:58 +01:00
|
|
|
|
2023-09-28 02:51:47 +01:00
|
|
|
traversal_func = '''
|
|
|
|
auto tail = returnArg.write((uintptr_t)&container)
|
|
|
|
.write(container.capacity())
|
|
|
|
.write(container.size());
|
|
|
|
|
|
|
|
for (const auto& el : container) {
|
|
|
|
tail = tail.delegate([&el](auto ret) {
|
2023-11-15 19:28:21 +00:00
|
|
|
return OIInternal::getSizeType<Ctx>(el, ret);
|
2023-09-28 02:51:47 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return tail.finish();
|
|
|
|
'''
|
|
|
|
|
|
|
|
[[codegen.processor]]
|
|
|
|
type = "types::st::VarInt<DB>"
|
|
|
|
func = "el.pointer = std::get<ParsedData::VarInt>(d.val).value;"
|
|
|
|
|
|
|
|
[[codegen.processor]]
|
|
|
|
type = "types::st::VarInt<DB>"
|
|
|
|
func = '''
|
|
|
|
el.container_stats.emplace(result::Element::ContainerStats{ .capacity = std::get<ParsedData::VarInt>(d.val).value });
|
|
|
|
'''
|
|
|
|
|
|
|
|
[[codegen.processor]]
|
2023-11-15 19:28:21 +00:00
|
|
|
type = "types::st::List<DB, typename TypeHandler<Ctx, T0>::type>"
|
2023-09-28 02:51:47 +01:00
|
|
|
func = """
|
2023-11-15 19:28:21 +00:00
|
|
|
static constexpr auto childField = make_field<Ctx, T0>("[]");
|
2023-09-28 02:51:47 +01:00
|
|
|
|
|
|
|
auto list = std::get<ParsedData::List>(d.val);
|
|
|
|
el.container_stats->length = list.length;
|
|
|
|
el.exclusive_size += (el.container_stats->capacity - el.container_stats->length) * sizeof(T0);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < list.length; i++)
|
|
|
|
stack_ins(childField);
|
|
|
|
"""
|
|
|
|
|