object-introspection/types/priority_queue_container_adapter_type.toml

53 lines
1.5 KiB
TOML

[info]
type_name = "std::priority_queue"
ctype = "CONTAINER_ADAPTER_TYPE"
header = "queue"
underlying_container_index = 1
stub_template_params = [2]
# Old:
typeName = "std::priority_queue<"
ns = ["namespace std"]
replaceTemplateParamIndex = []
underlyingContainerIndex = 1
[codegen]
decl = """
template<class T, class Container, class Cmp>
void getSizeType(const %1%<T, Container, Cmp> &container, size_t& returnArg);
"""
func = """
template<class T, class Container, class Cmp>
void getSizeType(const %1%<T, Container, Cmp> &containerAdapter, size_t& returnArg)
{
SAVE_DATA((uintptr_t)&containerAdapter);
// Only record the overhead of this container adapter - don't count the
// underlying container as that will be taken care of in its own
// getSizeType() function
SAVE_SIZE(sizeof(%1%<T, Container>) - sizeof(Container));
const Container &container = get_container(containerAdapter);
getSizeType(container, returnArg);
}
"""
handler = """
template <typename DB, typename T0, typename T1, typename T2>
struct TypeHandler<DB, %1%<T0, T1, T2>> {
using type = StaticTypes::Pair<DB,
StaticTypes::VarInt<DB>,
typename TypeHandler<DB, T1>::type>;
static StaticTypes::Unit<DB> getSizeType(
const %1%<T0, T1, T2>& container,
typename TypeHandler<DB, %1%<T0, T1, T2>>::type returnArg) {
auto tail = returnArg.write((uintptr_t)&container);
const T1 &underlyingContainer = get_container(container);
return OIInternal::getSizeType<DB>(underlyingContainer, tail);
}
};
"""