Hello Root,
I’m working on adding fields to an RNTupleModel
using AddField
, which requires an RFieldBase
. However, I don’t know the field type at compile time.
This works well for vectors, but I’m struggling to find a similar solution for primitive types. I see that RField
exists, but it requires specifying a type at compile time, is there any way to do this without having to write a switch over every type?
Here’s how I currently add a vector field, and I would like to do something similar for primitive types:
auto fieldName = "fieldName";
auto fieldTypeName = "std::vector<float>";
auto result = RVectorField::Create(fieldName, fieldTypeName);
auto vectorField = RVectorField::CreateUntyped(fieldName, result.Unwrap());
Cheers,
Nikolaj
ROOT Version: 6.33.01
Platform: Not Provided
Compiler: Not Provided