object-introspection/types/queue_container_adapter_type.toml
2023-06-30 12:54:02 +01:00

52 lines
1.4 KiB
TOML

[info]
type_name = "std::queue"
ctype = "CONTAINER_ADAPTER_TYPE"
header = "queue"
underlying_container_index = 1
# Old:
typeName = "std::queue<"
ns = ["namespace std"]
replaceTemplateParamIndex = []
underlyingContainerIndex = 1
[codegen]
decl = """
template<class T, class Container>
void getSizeType(const %1%<T, Container> &container, size_t& returnArg);
"""
func = """
template<class T, class Container>
void getSizeType(const %1%<T, Container> &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>
struct TypeHandler<DB, %1%<T0, T1>> {
using type = types::st::Pair<DB,
types::st::VarInt<DB>,
typename TypeHandler<DB, T1>::type>;
static types::st::Unit<DB> getSizeType(
const %1% <T0, T1> & container,
typename TypeHandler<DB, %1% <T0, T1>>::type returnArg) {
auto tail = returnArg.write((uintptr_t)&container);
const T1 &underlyingContainer = get_container(container);
return OIInternal::getSizeType<DB>(underlyingContainer, tail);
}
};
"""