I am currently working on a project that requires me to iterate over multiple fields and graph the contents of each field.
Currently, I am trying to establish a pointer to its data entry and loading it from that, however I see that it needs a specified type when establishing said pointer.
Is there a command that would allow me to create a field pointer without the need of specifying the type of the field?
The code I have currently looks like
auto ntuple = ROOT::Experimental::RNTupleReader::Open(rntupleName,newfileName);
for (const auto &value : ntuple->GetModel().GetDefaultEntry()){
auto entryPtr = value.GetPtr()
};
ROOT Version: 6.34.04 Platform: Not Provided Compiler: Not Provided
You can use value.GetPtr<void>(). Note that this also implies that you leave the type-safe land.
Depending on your use case, you can consider instead to use RNTupleReader::GetView(std::string_view fieldName, void *rawPtr, std::string_view typeName), which gives you runtime type checks.
In my case, I want to be able to use the data associated with each field.
In this case you should at some point in your program know the type of the data you’re operating on, so you can cast the pointer to the appropriate type. Otherwise all you can really do is memcpy’ing the data around.