diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-12-01 16:30:02 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-12-01 16:30:02 +0100 |
commit | aacda7e79342e3dfacd92da834703235f9b17396 (patch) | |
tree | 53ebab1044733b28c4fe07785e9c7846567564af /c++ | |
parent | 35e76eac52d5fbb370ddb92810d7daf4ea684beb (diff) |
tools: Ideas for flattening added
Diffstat (limited to 'c++')
-rw-r--r-- | c++/tools/c_gen_iface.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/c++/tools/c_gen_iface.hpp b/c++/tools/c_gen_iface.hpp index 42f694f..469c5c0 100644 --- a/c++/tools/c_gen_iface.hpp +++ b/c++/tools/c_gen_iface.hpp @@ -57,7 +57,33 @@ struct c_types { namespace schema { using namespace saw::schema; +/** +Pseudo flattened +using Foo = Struct< + Member<Array<Int32>, "a"> + Member<Array<Float32>, "b"> +>; + +Needs to be flattened to + +template<typename InnerSchema> +using FlattenedSchemaElement = Struct< + Member<Array<String>, "path">, + Member<InnerSchema, "inner_schema"> +>; + +// Illegal, but doable with more lines of code +// Just use typename... T and +// "T..." for +// "Member<FlattenedSchemaElement<Ele>,Names>..." +// and specialize somewhere else +template<typename... Ele, string_literal... Names> +using FlattenedSchema = Struct< + Member<String, "top_schema"> + Member<FlattenedSchemaElement<Ele>, Names>... +>; + */ using StructBindingSchema = Struct< Member<String, "kind">, Member<String, "key">, |