Project

General

Profile

Bug #1845

Request to extend FHICL C++ API so that <int> really means int.

Added by Rob Kutschke over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Infrastructure
Target version:
Start date:
09/13/2011
Due date:
% Done:

100%

Estimated time:
Occurs In:
Scope:
Internal
Experiment:
-
SSI Package:
Duration:

Description

I have had some comments from people that it would be useful to have a configurable policy, or an extended interface, in the FHICL C++ API so that an experiment could decide that the definition:

a : 1.5

cannot be converted to an integer. The expected behaviour is that:

fhicl::ParamerSet pset = ... ;
int i(pset.get&lt;int&gt;("a"));

would throw if if the definition of a contained a value with a non-zero fractional part. Of source the community has mixed feelings about whether or not 1.0 or 1. should be convertable to an integer: I happen to be in favour of it.

History

#1 Updated by Christopher Green over 8 years ago

  • Tracker changed from Bug to Feature

#2 Updated by Rob Kutschke over 8 years ago

I should also have mentioned that we could consider a policy with three options:

1. Keep doing what we do now an allow this.
2. Print a warning message when this occurs
3. Throw when this occurs.

#3 Updated by Rob Kutschke over 8 years ago

I suppose that another option is to write our own class that takes a parameter as a string, does the checking, and returns an int or is convertible to an int.

int i(pset.get<checked_int>("name"));

where checked_int (or whatever we call it?) is the type that does the work. If we go this way, where does check_int live, mu2e, fhicl-cpp, cetlib ....

Rob

#4 Updated by Walter E Brown over 8 years ago

  • Tracker changed from Feature to Bug
  • Category set to Infrastructure
  • Status changed from New to Resolved
  • Assignee set to Walter E Brown
  • Target version set to 1.00.00
  • % Done changed from 0 to 100

#5 Updated by Christopher Green over 8 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF