[ntuple] Consider making `REntry::AddValue()` publicly accessible
As per a request from @Nowakus, making REntry::AddValue() publicly accessible would be useful in some specific cases.
@Nowakus could you please comment in this issue why (I cannot recall now). Also, it would be helpful if you also attach your current workaround.
Lets start with the requirement:
What I want is a way to create a default object for one of the fields. Right now I need to do this:
obj = entry->GetValue(fieldname).GetField()->GenerateValue().GetRawPtr();
entry->CaptureValueUnsafe( fieldname, obj );
which is very convoluted and in addition it leaves object ownership to me for no good reason.
I think AddValue() can do all this and even make the RNTuple manage the created object, is that right?
(if not, that is what I would actually prefer)
Cheers, Marcin
What I want is a way to create a default object for one of the fields. Right now I need to do this:
obj = entry->GetValue(fieldname).GetField()->GenerateValue().GetRawPtr();entry->CaptureValueUnsafe( fieldname, obj );
@Nowakus I assume that entry above is a "bare" entry, no?
Yes, I create the Entry this way:
entry = ntupleWriter->GetModel()->CreateBareEntry();
In most cases the objects to be added to the ntuple are already existing, but in some cases one may be missing for a given Event so I create a default objects to fill out the empty Field.
Required flexibility for framework use should be given now by
RFieldBase::CreateObject()REntry::EmplaceNewValue()