From 1f66ef064a90df2dd642786f17b1ac1363ca8c8c Mon Sep 17 00:00:00 2001 From: Alastair Robertson Date: Tue, 26 Sep 2023 12:19:28 -0700 Subject: [PATCH] ContainerInfo: Read "extra" codegen field --- oi/ContainerInfo.cpp | 4 ++++ oi/ContainerInfo.h | 1 + types/README.md | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/oi/ContainerInfo.cpp b/oi/ContainerInfo.cpp index be6ee70..7d3d9ff 100644 --- a/oi/ContainerInfo.cpp +++ b/oi/ContainerInfo.cpp @@ -269,6 +269,10 @@ ContainerInfo::ContainerInfo(const fs::path& path) { codegenToml["traversal_func"].value()) { codegen.traversalFunc = std::move(*str); } + if (std::optional str = + codegenToml["extra"].value()) { + codegen.extra = std::move(*str); + } if (toml::array* arr = codegenToml["processor"].as_array()) { codegen.processors.reserve(arr->size()); diff --git a/oi/ContainerInfo.h b/oi/ContainerInfo.h index 7e15af3..776ab57 100644 --- a/oi/ContainerInfo.h +++ b/oi/ContainerInfo.h @@ -37,6 +37,7 @@ struct ContainerInfo { std::string func; std::string handler = ""; std::string traversalFunc = ""; + std::string extra = ""; std::vector processors{}; }; diff --git a/types/README.md b/types/README.md index 340fc10..1b70b4b 100644 --- a/types/README.md +++ b/types/README.md @@ -48,6 +48,12 @@ This document describes the format of the container definition files contained i `static types::st::Unit getSizeType(const T& container, ST returnArg)` where `ST` defines the combined static type of each supplied processor. +- `extra` + + Any extra C++ code to be included directly. This code is not automatically + wrapped in a namespace, so definitions from different container TOML files + will collide if they share the same name. + ## Changes introduced with Typed Data Segment - `decl` and `func` fields are ignored when using `-ftyped-data-segment` and the