Closed tmadlener closed 4 months ago
I think getValue
is an unintuitive name for a method returning optional instead of "value".
Code like parameter.GetValue<int>("foo").has_value()
reads a bit awkward
Since we are breaking interfaces in any case I don't mind different names. That would in principle allow us to properly deprecate getValue
as it is. On the other hand GenericParameters
is mainly used internally, so we could probably also just use new names without deprecation.
@tmadlener - ping. What's the status?
Currently testing what is breaking downstream (and then fixing that if necessary)
I think
getValue
is an unintuitive name for a method returning optional instead of "value". Code likeparameter.GetValue<int>("foo").has_value()
reads a bit awkward
I have changed this to get
as we are breaking things in any case
@Zehvogel a quick heads up:
- Rename the
setValue
andgetValue
functions to justset
andget
. This is also a breaking change, but as far as we are aware theGenericParameters
are only used internally in podio.
This bit here will require some changes to your RDataFrame code where you directly talk to the PARAMETERS
branch, mainly
- df = df.Define("xsec_fb", "PARAMETERS.getValue<float>(\"crossSection\")")
+ df = df.Define("xsec_fb", "PARAMETERS.get<float>(\"crossSection\")")
This bit here will require some changes to your RDataFrame code where you directly talk to the
PARAMETERS
branch, mainly
actually needed a
- df = df.Define("xsec_fb", "PARAMETERS.getValue<float>(\"crossSection\")")
+ df = df.Define("xsec_fb", "*PARAMETERS.get<float>(\"crossSection\")")
(or something intelligent :))
Ah yes, because it now also returns a std::optional
. so, either operator*
(as in your diff) or .value()
will get you the actual value and not the optional).
BEGINRELEASENOTES
GenericParameters
returnstd::optional
on non-existant keys instead of empty defaults. This allows to differentiate between empty (but set) and unset parameters, as the default value could actually be a valid parameter value for some types (e.g. integers or floats).setValue
andgetValue
functions to justset
andget
. This is also a breaking change, but as far as we are aware theGenericParameters
are only used internally in podio.Frame::getParameter
also return thisstd::optional
. This is a breaking change that might require adaptation of existing codeENDRELEASENOTES
Fixes #576
The following PRs make this introduction work transparently and need to be merged first to not break the nightlies