9 std::vector<const FunctionRequest*> sorted;
10 sorted.reserve(functions.
functions.size());
12 sorted.push_back(&function);
19 out +=
"#pragma once\n\n";
20 out +=
"#include \"MayaFlux/Transitive/Reflect/Describe.hpp\"\n\n";
21 out +=
"#ifndef MAYAFLUX_REFLECT_SCAN\n\n";
22 out +=
"namespace MayaFlux::Reflect::Generated {\n\n";
24 out +=
"template <>\n";
25 out +=
"struct Signature<" + function->
expression +
"> {\n";
26 out +=
" static constexpr std::string_view name = \"" + function->
name +
"\";\n";
27 out +=
" static constexpr std::size_t required = " + std::to_string(function->
required) +
";\n";
28 out +=
" static constexpr std::array<std::string_view, " + std::to_string(function->
parameters.size())
30 for (std::size_t i = 0; i < function->
parameters.size(); ++i) {
31 out += i == 0 ?
" " :
", ";
34 out += function->
parameters.empty() ?
"};\n" :
" };\n";
35 out +=
"\n template <std::size_t K, typename Values>\n";
36 out +=
" static decltype(auto) call(Values& values)\n {\n";
37 for (std::size_t count = function->
required; count <= function->parameters.size(); ++count) {
38 out += count == function->
required ?
" if constexpr (K == " :
" } else if constexpr (K == ";
39 out += std::to_string(count) +
") {\n";
40 out +=
" return " + function->
callee +
"(";
41 for (std::size_t i = 0; i < count; ++i) {
42 out += i == 0 ?
"" :
", ";
43 out +=
"std::get<" + std::to_string(i) +
">(values)";
48 out +=
" static_assert(K != K, \"the sidecar has no call with that many arguments\");\n";
53 out +=
"}\n\n#endif\n";
61 last = std::max(last, function.
line);
68 const std::vector<std::filesystem::path>& headers,
69 const std::vector<std::filesystem::path>&
existing)
71 std::vector<std::string> problems;
73 for (
const auto& header : headers) {
74 const auto found = requests.find(header);
75 if (found == requests.end()) {
76 problems.push_back(header.string() +
": contains MF_DESCRIBE_FUNCTION text but produced no request");
83 problems.push_back(sidecar.string() +
": missing sidecar");
85 problems.push_back(sidecar.string() +
": differs from what the generator would write");
89 problems.push_back(*problem);
93 for (
const auto& sidecar :
existing) {
94 const std::string name = sidecar.filename().string();
96 const std::filesystem::path header = sidecar.parent_path() / (stem +
".hpp");
97 if (!requests.contains(header)) {
98 problems.push_back(sidecar.string() +
": orphaned, its header has no MF_DESCRIBE_FUNCTION request");
Cycle Behavior: The for_cycles(N) configuration controls how many times the capture operation execute...