2022-12-19 14:37:51 +00:00
|
|
|
[info]
|
2023-05-23 22:26:38 +01:00
|
|
|
type_name = "std::pair"
|
2022-12-19 14:37:51 +00:00
|
|
|
ctype = "PAIR_TYPE"
|
|
|
|
header = "utility"
|
2023-05-23 22:26:38 +01:00
|
|
|
|
|
|
|
# Old:
|
|
|
|
typeName = "std::pair<"
|
2022-12-19 14:37:51 +00:00
|
|
|
ns = ["namespace std"]
|
2023-05-23 22:26:38 +01:00
|
|
|
numTemplateParams = 2
|
2022-12-19 14:37:51 +00:00
|
|
|
replaceTemplateParamIndex = []
|
|
|
|
|
|
|
|
[codegen]
|
|
|
|
decl = """
|
|
|
|
template<typename P, typename Q>
|
2023-05-23 22:26:38 +01:00
|
|
|
void getSizeType(const %1%<P,Q> &container, size_t& returnArg);
|
2022-12-19 14:37:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
func = """
|
|
|
|
template<typename P, typename Q>
|
2023-05-23 22:26:38 +01:00
|
|
|
void getSizeType(const %1%<P,Q> &container, size_t& returnArg)
|
2022-12-19 14:37:51 +00:00
|
|
|
{
|
|
|
|
SAVE_SIZE(sizeof(%1%<P,Q>) - sizeof(P) - sizeof(Q));
|
|
|
|
|
2023-05-23 22:26:38 +01:00
|
|
|
getSizeType(container.first, returnArg);
|
|
|
|
getSizeType(container.second, returnArg);
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
"""
|
2023-04-20 17:52:58 +01:00
|
|
|
|
|
|
|
handler = """
|
|
|
|
template <typename DB, typename T0, typename T1>
|
|
|
|
struct TypeHandler<DB, %1%<T0, T1>> {
|
2023-06-29 13:07:46 +01:00
|
|
|
using type = types::st::Pair<DB,
|
2023-04-20 17:52:58 +01:00
|
|
|
typename TypeHandler<DB, T0>::type,
|
|
|
|
typename TypeHandler<DB, T1>::type>;
|
|
|
|
|
2023-06-29 13:07:46 +01:00
|
|
|
static types::st::Unit<DB> getSizeType(
|
2023-04-20 17:52:58 +01:00
|
|
|
const %1%<T0, T1> & container,
|
|
|
|
typename TypeHandler<DB, %1%<T0, T1>>::type returnArg) {
|
|
|
|
return OIInternal::getSizeType<DB>(
|
|
|
|
container.second,
|
|
|
|
returnArg.delegate([&container](auto ret) {
|
|
|
|
return OIInternal::getSizeType<DB>(container.first, ret);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
"""
|
2023-08-16 20:40:36 +01:00
|
|
|
|
|
|
|
traversal_func = """
|
|
|
|
return OIInternal::getSizeType<DB>(
|
|
|
|
container.second,
|
|
|
|
returnArg.delegate([&container](auto ret) {
|
|
|
|
return OIInternal::getSizeType<DB>(container.first, ret);
|
|
|
|
})
|
|
|
|
);
|
|
|
|
"""
|
|
|
|
|
|
|
|
[[codegen.processor]]
|
|
|
|
type = "types::st::Pair<DB, typename TypeHandler<DB, T0>::type, typename TypeHandler<DB, T1>::type>"
|
|
|
|
func = """
|
2023-08-25 18:36:42 +01:00
|
|
|
static constexpr auto firstField = make_field<DB, T0>("first");
|
|
|
|
static constexpr auto secondField = make_field<DB, T1>("second");
|
2023-08-16 20:40:36 +01:00
|
|
|
|
|
|
|
el.exclusive_size = sizeof(std::pair<T0, T1>) - sizeof(T0) - sizeof(T1);
|
|
|
|
ins.emplace(secondField);
|
|
|
|
ins.emplace(firstField);
|
|
|
|
"""
|