Project

General

Profile

Feature #4107

A candidate function for FHICLCPP

Added by Rob Kutschke over 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Infrastructure
Target version:
Start date:
Due date:
09/30/2013
% Done:

100%

Estimated time:
16.00 h
Scope:
Internal
Experiment:
Mu2e
SSI Package:
fhicl-cpp
Duration:

Description

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:

https://cdcvs.fnal.gov/redmine/projects/art-workbook/repository/revisions/develop/show/art-workbook/ExUtilities

I am not married to this implementation.

For an example of how to use it:

https://cdcvs.fnal.gov/redmine/projects/art-workbook/repository/revisions/develop/entry/art-workbook/ExN/MinimumHits_module.cc


Related issues

Related to art - Feature #8770: Implement parameter set validation - task 3a of issue #7538Closed02/02/201208/01/2015

History

#1 Updated by Christopher Green over 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 (06/14/2013)
  • Estimated time set to 16.00 h
  • Scope set to Internal
  • Experiment Mu2e added
  • SSI Package fhicl-cpp added

#2 Updated by Christopher Green almost 6 years ago

  • Target version changed from 1.09.00 to 521

#3 Updated by Kyle Knoepfel over 4 years ago

  • Related to Feature #8770: Implement parameter set validation - task 3a of issue #7538 added

#4 Updated by Kyle Knoepfel over 4 years ago

  • Status changed from Accepted to Resolved
  • Target version changed from 521 to 1.18.00
  • % Done changed from 0 to 100

The ParameterSet validation feature, as described in issue #8770, addresses this issue. Will mark this as resolved.

#5 Updated by Kyle Knoepfel about 4 years ago

  • Target version changed from 1.18.00 to 1.16.00

#6 Updated by Christopher Green about 4 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF