Skip to content

Conditional configuration objects should be able to report if they were enabled #3

@knoepfel

Description

@knoepfel

This issue has been migrated from https://cdcvs.fnal.gov/redmine/issues/17964 (FNAL account required)
Originally created by @PetrilloAtWork on 2017-10-19 14:33:44


Using a fhicl::Sequence<std::string> names in my configuration structure, which was conditionally enabled and with no default value.
When names is disabled, a call names() returns a vector with a single empty string in it (of course, no value was provided from the configuration).
I am told this is the current expected behaviour, of initialising the container with a single, default-constructed element.
I would like to have:

  1. definition of what to expect from that value; "undefined" is also acceptable to me, although the expectation would have been an empty collection
  2. a way to determine if the atom, sequence or table was enabled; right now I can use names.should_use() which seems to do the right thing, but it is undocumented and it's not clear whether it is considered part of the stable user interface

The quickest acceptable solution to me is to declare the content of the parameter undefined unless the parameter is enabled, and to have should_use() blessed for common use. I would though recommend a more user-friendly name for it (maybe enabled()... I am not good with names!).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureAn enhancement to the project

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions