Project

General

Profile

Feature #9362

Feature #9078: ParameterSet validation enhancements

Create optional fhiclcpp types

Added by Kyle Knoepfel about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/02/2015
Due date:
% Done:

100%

Estimated time:
24.00 h
Spent time:
Duration:

Description

It is not uncommon for users of fhiclcpp to have optional parameters -- those that are not required to be present in a configuration file, but whose values can be retrieved if they are. This should be supported for the fhiclcpp basic types (issue #8773) and converting types (issue #8962). The optional parameters can be:

// Basic optional types
OptionalAtom    <T>
OptionalSequence<T>
OptionalSequence<T,SZ>
OptionalTable   <T>
OptionalTuple   <T...>

// Converting optional type
OptionalTupleAs <U,T...>

Related issues

Blocks art - Feature #10749: Implement fhicl::Optional* parameters in artClosed11/03/2015

Blocked by fhicl-cpp - Feature #10817: ParameterSet::has_key should be able to look up nested keysClosed11/05/2015

History

#1 Updated by Kyle Knoepfel about 4 years ago

  • Description updated (diff)

#2 Updated by Kyle Knoepfel about 4 years ago

  • Category set to Infrastructure
  • Status changed from New to Assigned
  • Assignee set to Kyle Knoepfel
  • Target version set to 2.01.00
  • Estimated time set to 24.00 h
  • SSI Package fhicl-cpp added
  • SSI Package deleted ()

These types need to provide functionality similar to pset.get_if_present. For example:

OptionalAtom<int> optionalParameter { Key("someKey") };
int value{};
if ( optionalParameter(value) ) { // presence of 'someKey' is determined
 // can now access 'value'
}
// Same behavior for other fhiclcpp types

In other words, a call to (e.g.) OptionalAtom<int>::operator(), or something similar, returns 'true' if someKey is present in the configuration file, and 'false' otherwise. Optional types will not support default values.

The time estimate reflects the 8 hours necessary to implement the class templates, and 16 hours to test them.

#3 Updated by Kyle Knoepfel about 4 years ago

  • Project changed from art to fhicl-cpp
  • Category deleted (Infrastructure)

#4 Updated by Kyle Knoepfel almost 4 years ago

  • Blocks Feature #10749: Implement fhicl::Optional* parameters in art added

#5 Updated by Kyle Knoepfel almost 4 years ago

  • Blocked by Feature #10817: ParameterSet::has_key should be able to look up nested keys added

#6 Updated by Kyle Knoepfel almost 4 years ago

  • % Done changed from 0 to 20

The OptionalAtom<T> class has been implemented.

#7 Updated by Kyle Knoepfel almost 4 years ago

  • % Done changed from 20 to 80

Class templates OptionalTable<T> and OptionalSequence<T(,SZ)> have been implemented.

#8 Updated by Kyle Knoepfel almost 4 years ago

  • Description updated (diff)

#9 Updated by Kyle Knoepfel almost 4 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 100

Implement with fhicl-cpp:2abd2e3. The OptionalTupleAs type will be implemented whenever the TupleAs feature is provided. Documentation is forthcoming.

#10 Updated by Kyle Knoepfel over 3 years ago

  • Target version changed from 2.01.00 to 1.17.05

#11 Updated by Kyle Knoepfel over 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF