mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 19:19:05 +01:00
68290655b1
This change is fully backwards compatible with the old ContainerInfo parser, as it is just adding new fields. The old fields will continue to be used by legacy OICodeGen until that is removed. Also add a README to document the format.
42 lines
1.1 KiB
TOML
42 lines
1.1 KiB
TOML
[info]
|
|
type_name = "folly::IOBuf"
|
|
ctype = "FOLLY_IOBUF_TYPE"
|
|
header = "folly/io/IOBuf.h"
|
|
|
|
# Old:
|
|
typeName = "folly::IOBuf"
|
|
matcher = "^folly::IOBuf$"
|
|
ns = ["folly::IOBuf"]
|
|
numTemplateParams = 0
|
|
replaceTemplateParamIndex = []
|
|
|
|
[codegen]
|
|
decl = """
|
|
void getSizeType(const %1% &container, size_t& returnArg);
|
|
"""
|
|
|
|
func = """
|
|
void getSizeType(const %1% &container, size_t& returnArg)
|
|
{
|
|
SAVE_SIZE(sizeof(%1%));
|
|
|
|
// We calculate the length of all IOBufs in the chain manually.
|
|
// IOBuf has built-in computeChainCapacity()/computeChainLength()
|
|
// functions which do this for us. But dead code optimization in TAO
|
|
// caused these functions to be removed which causes relocation
|
|
// errors.
|
|
|
|
std::size_t fullLength = container.length();
|
|
std::size_t fullCapacity = container.capacity();
|
|
for (const IOBuf* current = container.next(); current != &container;
|
|
current = current->next()) {
|
|
fullLength += current->length();
|
|
fullCapacity += current->capacity();
|
|
}
|
|
SAVE_DATA(fullCapacity);
|
|
SAVE_DATA(fullLength);
|
|
|
|
SAVE_SIZE(fullCapacity);
|
|
}
|
|
"""
|