A candidate function for FHICLCPP
I suggest that we add a tool to fhiclcpp to check white-lists and black-lists for the parameter names in a parameter set. This can be used by end-users as they see fit.
I had in mind a pair of classes with constructors with a signatures like:
PSetWhiteList::PSetWhiteList( std::vector<std::string> const& whiteList, fhicl::ParameterSet const& pset, bool allowArtKeys = true, bool throwOnBad = true ); PSetBlackList::PSetBlackList( std::vector<std::string> const& blackList, fhicl::ParameterSet const& pset, bool allowArtKeys = true, bool throwOnBad = true );
The first of these would flag any parameters not found on the white list and the latter would flag any found on the black list. In both cases we can optionally include module_type and module_label on the list ( controlled by the third argument ). And we can have the c'tor throw when an error is present depending on the value of the last argument.
I also suggest that we provide some accessors that allow the end-user to learn what flaws are present and to format their own messages - obviously his only makes sense if the last argument is overridden to false.
If we decide that the class will always throw on an error, then i guess a free function is enough.
A prototype for the white-list code is in:
I am not married to this implementation.
For an example of how to use it:
#1 Updated by Christopher Green about 6 years ago
- Due date set to 09/30/2013
- Category set to Infrastructure
- Status changed from New to Accepted
- Target version set to 1.09.00
- Start date deleted (
- Estimated time set to 16.00 h
- Scope set to Internal
- Experiment Mu2e added
- SSI Package fhicl-cpp added