Propose that art take over this helper function
This is closely related to issue 3202
We propose that the following code be supported by the art team - I am not sure of the appropriate place for it.
Mu2e has written a specialization of the template
T fhicl::ParameterSet::get<std::vector<T>>( std::string const & key ) const;
for T of std::vector<art::InputTag>.
This permits you to write:
auto tags = pset.get<std::vector<art::inputTag>>("myInputTags");
We chose not to provide the corresponding specialization for a single art::InputTag because we feel that the following is simple enough:
art::InputTag tag = pset.get<string>("myInputTag");
My personal recommendation is to remove the specialization that accepts a default value as the second argument. I know that this breaks the code symmetry but I want all inputTags to be exposed in fcl files. Mu2e has both specializations because we currently have code that depends on the specialization that has a default.
#1 Updated by Christopher Green over 6 years ago
- Category set to Infrastructure
- Status changed from New to Accepted
- Target version set to 1.09.03
- Estimated time set to 2.00 h
- SSI Package art added
- SSI Package deleted (
We believe this can be shoehorned into the upcoming 1.09.03 without being the critical path for that release.
#6 Updated by Kyle Knoepfel over 5 years ago
- Status changed from Assigned to Resolved
- Start date changed from 05/01/2014 to 02/05/2015
Implementing this feature involved overloading the
fhicl::detail::decode function to allow for conversions from
art::InputTag. By overloading this one function, the following conversions are now allowed:
pset.get< art::InputTag >(...) pset.get<std::vector<art::InputTag>>(...) pset.get_if_present< art::InputTag >(...) pset.get_if_present<std::vector<art::InputTag>>(...)
The functions that allow for default values are still supported with the
std::vector<art::InputTag> template arguments, in accord with other currently supported template arguments. Whether or not a default value is provided is a policy decision that is left to the individual experiments.
Implemented with 28b8af5fe34905065b275c93928043dc7f32d9be.