This page is under construction
ParameterSet from only a FHiCL document¶
ParameterSet object can be obtained directly from a FHiCL document by calling a function,
make_ParameterSet. The call takes one of two forms, depending on how the document is represented.
- Given a FHiCL document represented by a variable
#include "fhiclcpp/make_ParameterSet.h" ... fhicl::ParameterSet pset; fhicl::make_ParameterSet(doc, pset);
- Given a FHiCL document contained in an external text file, there is the slight complication of finding the correct file. This is handled by appealing to functionality found in the external
cetliblibrary. Given (a) the file's name as a variable
std::stringand (b) a variable
makerof static type
#include "fhiclcpp/make_ParameterSet.h" ... fhicl::ParameterSet pset; fhicl::make_ParameterSet(fname, maker, pset);
In either case, the resulting
ParameterSet will contain precisely those name-value pairs specified by the FHiCL document, taking into account any FHiCL (a)
#include directives, (b) name overrides, and (c) references in the documents. The
ParameterSet does not track the origin of any resulting pair.
ParameterSet from multiple sources¶
In practice, it is often the case that a FHiCL document is not the sole source for obtaining a
ParameterSet. Additional information may come from command-line arguments, for example, and may be used to augment or otherwise adjust a
ParameterSet before it is considered finalized.
While it is possible to update a
ParameterSet directly (e.g., via its
erase member functions), such an approach is not generally recommended, as the design of the
ParameterSet class is strongly biased in favor of inspection and retrieval operations and against modifications. This is the reason for the earlier recommendation that a
ParameterSet be generally treated as immutable.
For this reason, the
fhiclcpp library provides a type,
intermediate_table, that can capture information presented by a FHiCL document, can be readily updated, and can be used to obtain a
ParameterSet. As detailed below, an
intermediate_table has some characteristics reminiscent of a
ParameterSet, some characteristics reminiscent of a FHiCL document, and some characteristics of its own. We first discuss two other types,
extended_value, that provide support for
fhicl::value_tag consists of the enumerated values
UNKNOWN. These are used as a classification scheme roughly corresponding to FHiCL's value categories; each
extended_value is accompanied by one of these enumerations. While some values can be self-classified, others can't be classified without outside help. For example, it is unclear whether the
std::string whose value is
nil is intended to be the FHiCL
nil value or just a FHiCL string value.
value_tag always accompanies an
extended_value, both these types are declared in the