Project

General

Profile

Fhiclcpp types in detail » History » Version 39

Kyle Knoepfel, 11/18/2015 04:03 PM

1 1 Kyle Knoepfel
h1. @fhiclcpp@ types in detail
2 1 Kyle Knoepfel
3 34 Kyle Knoepfel
{{toc}}
4 1 Kyle Knoepfel
5 9 Kyle Knoepfel
----
6 9 Kyle Knoepfel
7 17 Kyle Knoepfel
h1(#ctors). Parameter constructors
8 1 Kyle Knoepfel
9 18 Kyle Knoepfel
h2(#ctors_rules). %{color:blue}General rules%
10 1 Kyle Knoepfel
11 1 Kyle Knoepfel
For each of the @fhiclcpp@ types, the following rules apply:
12 12 Kyle Knoepfel
* The @Name@ argument is required.
13 12 Kyle Knoepfel
* If there is more than one argument, the @Name@ argument must be first in the list.
14 12 Kyle Knoepfel
* If there are three arguments, the relative order of the @Comment@ argument and default-value argument is not important.
15 12 Kyle Knoepfel
<pre><code class="cpp">
16 12 Kyle Knoepfel
Atom<int> val { Name("val"), Comment("Some parameter"), 9 }; // is equivalent to
17 12 Kyle Knoepfel
Atom<int> val { Name("val"), 9, Comment("Some parameter") };
18 12 Kyle Knoepfel
</code></pre>
19 32 Kyle Knoepfel
* Neither the @Table<T>@ parameter nor any of the @Optional*@ parameters support a default value.
20 1 Kyle Knoepfel
21 39 Kyle Knoepfel
h3(#opt_comment). Note about optional parameters
22 39 Kyle Knoepfel
23 39 Kyle Knoepfel
In addition to @Optional*@ parameters not supporting default values, they also cannot be used as template arguments to *any* @fhiclcpp@ types:
24 39 Kyle Knoepfel
25 39 Kyle Knoepfel
<pre><code class="cpp">
26 39 Kyle Knoepfel
Sequence< OptionalSequence<int> >     e1 { ... };  // error
27 39 Kyle Knoepfel
Sequence< OptionalSequence<int,2u> >  e2 { ... };  // error
28 39 Kyle Knoepfel
Sequence< OptionalTuple<int,double> > e3 { ... };  // error
29 39 Kyle Knoepfel
OptionalSequence< Sequence<int> >     e4 { ... };  // ok
30 39 Kyle Knoepfel
</code></pre>
31 39 Kyle Knoepfel
32 39 Kyle Knoepfel
33 18 Kyle Knoepfel
h2(#atom). %{color:blue}@Atom<T>@%
34 7 Kyle Knoepfel
35 1 Kyle Knoepfel
<pre><code class="cpp">
36 1 Kyle Knoepfel
Atom<int> var { Name("var") };
37 1 Kyle Knoepfel
Atom<int> var { Name("var"), 9 };
38 7 Kyle Knoepfel
Atom<int> var { Name("var"), Comment("A parameter description") };
39 1 Kyle Knoepfel
Atom<int> var { Name("var"), Comment("A parameter description"), 9 };
40 1 Kyle Knoepfel
</code></pre>
41 33 Kyle Knoepfel
42 39 Kyle Knoepfel
43 33 Kyle Knoepfel
h2(#opt_atom). %{color:blue}@OptionalAtom<T>@%
44 33 Kyle Knoepfel
45 33 Kyle Knoepfel
<pre><code class="cpp">
46 33 Kyle Knoepfel
OptionalAtom<int> var { Name("var") };
47 33 Kyle Knoepfel
OptionalAtom<int> var { Name("var"), Comment("A parameter description") };
48 33 Kyle Knoepfel
</code></pre>
49 33 Kyle Knoepfel
50 33 Kyle Knoepfel
h2(#opt_vector). %{color:blue}@OptionalSequence<T>@%
51 1 Kyle Knoepfel
52 39 Kyle Knoepfel
This class template is used for unbounded sequences.
53 33 Kyle Knoepfel
54 33 Kyle Knoepfel
<pre><code class="cpp">
55 33 Kyle Knoepfel
OptionalSequence<int> seq { Name("seq") };
56 33 Kyle Knoepfel
OptionalSequence<int> seq { Name("seq"), Comment("A sequence") };
57 33 Kyle Knoepfel
</code></pre>
58 33 Kyle Knoepfel
59 33 Kyle Knoepfel
h2(#opt_array). %{color:blue}@OptionalSequence<T,std::size_t>@%
60 33 Kyle Knoepfel
61 33 Kyle Knoepfel
This class template is used for sequences of a specific length, known at compile time.
62 33 Kyle Knoepfel
63 33 Kyle Knoepfel
<pre><code class="cpp">
64 33 Kyle Knoepfel
OptionalSequence<int,3u> seq { Name("seq") };
65 33 Kyle Knoepfel
OptionalSequence<int,3u> seq { Name("seq"), Comment("A sequence") };
66 33 Kyle Knoepfel
</code></pre>
67 33 Kyle Knoepfel
68 33 Kyle Knoepfel
h2(#opt_table). %{color:blue}@OptionalTable<T>@%
69 33 Kyle Knoepfel
70 33 Kyle Knoepfel
<pre><code class="cpp">
71 33 Kyle Knoepfel
OptionalTable<T> config { Name("config") };
72 33 Kyle Knoepfel
OptionalTable<T> config { Name("config"), Comment("This describes the table") };
73 33 Kyle Knoepfel
</code></pre>
74 33 Kyle Knoepfel
75 33 Kyle Knoepfel
h2(#opt_tuple). %{color:blue}@OptionalTuple<T...>@%
76 33 Kyle Knoepfel
77 33 Kyle Knoepfel
<pre><code class="cpp">
78 33 Kyle Knoepfel
OptionalTuple<string,bool> tuple { Name("tuple") };
79 33 Kyle Knoepfel
OptionalTuple<string,bool> tuple { Name("tuple"), Comment("A tuple") };
80 33 Kyle Knoepfel
</code></pre>
81 33 Kyle Knoepfel
82 18 Kyle Knoepfel
h2(#vector). %{color:blue}@Sequence<T>@%
83 1 Kyle Knoepfel
84 18 Kyle Knoepfel
This class template is used for unbounded sequences.  See the two caveats below.
85 18 Kyle Knoepfel
86 1 Kyle Knoepfel
<pre><code class="cpp">
87 7 Kyle Knoepfel
Sequence<int> seq { Name("seq") };
88 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence") };
89 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>{ 4, 5, 6, 7 } };
90 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), { 4, 5, 6, 7 } };
91 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence"), Sequence<int>{ 4, 5, 6, 7 } };
92 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Comment("A sequence"), { 4, 5, 6, 7 } };
93 1 Kyle Knoepfel
</code></pre>
94 1 Kyle Knoepfel
95 1 Kyle Knoepfel
h3(#make_empty). @Sequence<T>::make_empty()@
96 1 Kyle Knoepfel
97 8 Kyle Knoepfel
Due to the implementation details of the unbounded sequence, the following:
98 1 Kyle Knoepfel
99 8 Kyle Knoepfel
<pre><code class="cpp">
100 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>{} }; // Don't do this.
101 1 Kyle Knoepfel
</code></pre>
102 1 Kyle Knoepfel
103 18 Kyle Knoepfel
_does not_ represent an empty sequence.  If you would like an empty sequence as a default value, use the following:
104 1 Kyle Knoepfel
105 1 Kyle Knoepfel
<pre><code class="cpp">
106 1 Kyle Knoepfel
Sequence<int> seq { Name("seq"), Sequence<int>::make_empty() };
107 1 Kyle Knoepfel
</code></pre>
108 1 Kyle Knoepfel
109 18 Kyle Knoepfel
h3(#narrowing). Precaution regarding narrowing conversions and @std::initializer_list@ objects
110 1 Kyle Knoepfel
111 19 Kyle Knoepfel
The following configuration will trigger a compilation warning:
112 19 Kyle Knoepfel
113 19 Kyle Knoepfel
<pre><code class="cpp">
114 19 Kyle Knoepfel
Sequence<int> seq1 { Name("seq1"), Sequence<int>{ 1, 2.4e-4 } };
115 19 Kyle Knoepfel
Sequence<int> seq2 { Name("seq2"), { 1, 2.4e-4 } };
116 19 Kyle Knoepfel
</code></pre>
117 19 Kyle Knoepfel
118 19 Kyle Knoepfel
that looks similar to this:
119 18 Kyle Knoepfel
120 18 Kyle Knoepfel
<pre>
121 18 Kyle Knoepfel
warning: narrowing conversion of ‘2.4000000000000001e-4’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
122 18 Kyle Knoepfel
</pre>
123 1 Kyle Knoepfel
124 1 Kyle Knoepfel
For build systems that convert compile-time warnings to errors, this will result in a build failure.  The warning results from the nature of an @std::initializer_list@ object, signified by @'{1, 2.4e-4}'@, which is used to initialize the sequence objects.  For @std::initializer_list@ objects, narrowing conversions are not allowed--that is, converting a @double@ to an @int@ is an example of narrowing that results in loss of information.  This is the most likely example of where you may find a narrowing conversion.
125 1 Kyle Knoepfel
126 1 Kyle Knoepfel
h2(#array). %{color:blue}@Sequence<T,std::size_t>@%
127 1 Kyle Knoepfel
128 1 Kyle Knoepfel
This class template is used for sequences of a specific length, known at compile time.
129 1 Kyle Knoepfel
130 1 Kyle Knoepfel
<pre><code class="cpp">
131 1 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq") };
132 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence") };
133 17 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Sequence<int,3u>{ 4, 5, 6 } };
134 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), { 4, 5, 6 } };
135 18 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence"), Sequence<int,3u>{ 4, 5, 6 } };
136 1 Kyle Knoepfel
Sequence<int,3u> seq { Name("seq"), Comment("A sequence"), { 4, 5, 6 } };
137 1 Kyle Knoepfel
</code></pre>
138 1 Kyle Knoepfel
139 1 Kyle Knoepfel
The warning regarding narrowing conversions [[Fhiclcpp_types_in_detail#narrowing|above]] applies for bounded sequences as well.
140 1 Kyle Knoepfel
141 33 Kyle Knoepfel
h2(#table). %{color:blue}@Table<T>@%
142 33 Kyle Knoepfel
143 33 Kyle Knoepfel
<pre><code class="cpp">
144 33 Kyle Knoepfel
Table<T> config { Name("config") };
145 33 Kyle Knoepfel
Table<T> config { Name("config"), Comment("This describes the table") };
146 33 Kyle Knoepfel
</code></pre>
147 33 Kyle Knoepfel
148 1 Kyle Knoepfel
h2(#tuple). %{color:blue}@Tuple<T...>@%
149 1 Kyle Knoepfel
150 1 Kyle Knoepfel
<pre><code class="cpp">
151 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple") };
152 18 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple") };
153 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Tuple<string,bool>{"explicit?", true} };
154 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), {"compact?", true } };
155 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple"), Tuple<string,bool>{ "Particle physics is neat.", true } };
156 1 Kyle Knoepfel
Tuple<string,bool> tuple { Name("tuple"), Comment("A tuple"), { "This is false", false } };
157 1 Kyle Knoepfel
</code></pre>
158 1 Kyle Knoepfel
159 1 Kyle Knoepfel
----
160 1 Kyle Knoepfel
161 35 Kyle Knoepfel
h1(#return). Standard parameters - return types
162 35 Kyle Knoepfel
163 38 Kyle Knoepfel
_[ In what follows, @array@, @string@, @tuple@, and @vector@ should each be prefaced with the appropriate namespace resolution: '@std::@'. ]_
164 37 Kyle Knoepfel
165 1 Kyle Knoepfel
|{background:#fba}. *@fhiclcpp@ parameter*|{background:#fba}. *Function call*|{background:#fba}. *Return type*|
166 1 Kyle Knoepfel
|\3{background:#ddd}. _Simple @fhiclcpp@ parameters_|
167 37 Kyle Knoepfel
|@Atom<string> label@; |@label()@| @string const&@|
168 37 Kyle Knoepfel
|/2.@Sequence<int> counts@; | @counts()@ | @vector<int>@|
169 35 Kyle Knoepfel
|@counts(1)@ | @int@ |
170 37 Kyle Knoepfel
|/2.@Sequence<double, 3u> point@;| @point()@ | @array<double, 3u>@|
171 1 Kyle Knoepfel
|@point(0)@ | @double@ |
172 37 Kyle Knoepfel
|/3.@Tuple<string, double> assoc;@|@assoc()@| @tuple<string, double>@|
173 37 Kyle Knoepfel
|@assoc.get<0>()@|@string@|
174 35 Kyle Knoepfel
|@assoc.get<double>()@|@double@|
175 35 Kyle Knoepfel
|@Table<Config> config;@|@config()@|@Config const&@|
176 35 Kyle Knoepfel
|\3{background:#ddd}. _Nested @fhiclcpp@ parameters_|
177 37 Kyle Knoepfel
|/2.@Sequence< Sequence<int> > datasets;@ | @datasets()@ | @vector< vector<int> >@ |
178 37 Kyle Knoepfel
| @datasets(17)@ | @vector<int>@ |
179 37 Kyle Knoepfel
|/2.@Sequence< Sequence<int>, 2u > twoDatasets;@ | @twoDatasets()@ | @array< vector<int>, 2u >@ |
180 37 Kyle Knoepfel
|@twoDatasets(1)@ | @vector<int>@ |
181 37 Kyle Knoepfel
|/2.@Sequence< Sequence<int, 2u> > intPairs;@ | @intPairs()@ | @vector< array<int, 2u> >@ |
182 37 Kyle Knoepfel
|@intPairs(42)@ | @array<int, 2u>@|
183 37 Kyle Knoepfel
|/2.@Sequence< Tuple<string, int, bool> > triplets;@ | @triplets()@ | @vector< tuple<string, int, bool> >@ |
184 37 Kyle Knoepfel
|@triplets(3)@ | @tuple<string, int, bool>@ |
185 37 Kyle Knoepfel
|/2.@Sequence< Table<Config> > manyConfigTables;@ | @manyConfigTables()@ | @vector< Config >@ |
186 35 Kyle Knoepfel
|@manyConfigTables(6)@ | @Config const&@ |
187 37 Kyle Knoepfel
|/3.@Tuple< string, Table<Config> > configAssoc;@ | @configAssoc()@ | @tuple< string, Config >@ |
188 37 Kyle Knoepfel
|@configAssoc.get<0>()@ | @string@ |
189 35 Kyle Knoepfel
|@configAssoc.get<1>()@ | @Config@ |
190 37 Kyle Knoepfel
|/3.@Tuple< Tuple<string,bool>, Sequence<int> > awkward;@ | @awkward()@ | @tuple< tuple<string, bool>, vector<int> >@ |
191 37 Kyle Knoepfel
|@awkward.get<0>()@|@tuple<string,bool>@|
192 37 Kyle Knoepfel
|@awkward.get<1>()@|@vector<int>@|
193 1 Kyle Knoepfel
194 36 Kyle Knoepfel
h1(#opt_arg). @Optional@ parameters - argument types
195 1 Kyle Knoepfel
196 38 Kyle Knoepfel
The usage pattern for @Optional@ @fhiclcpp@ parameters is:
197 38 Kyle Knoepfel
198 38 Kyle Knoepfel
<pre><code class="cpp">
199 38 Kyle Knoepfel
OptionalAtom<string> message { Name("message") };
200 38 Kyle Knoepfel
201 38 Kyle Knoepfel
string filled_msg; // passed argument
202 38 Kyle Knoepfel
203 38 Kyle Knoepfel
if ( message(filled_msg) ) {
204 38 Kyle Knoepfel
   // use 'filled_msg'
205 38 Kyle Knoepfel
}
206 38 Kyle Knoepfel
</code></pre>
207 38 Kyle Knoepfel
208 38 Kyle Knoepfel
The following table gives the required passed-argument types for a given @Optional@ parameter.
209 38 Kyle Knoepfel
210 38 Kyle Knoepfel
_[ In what follows, @array@, @string@, @tuple@, and @vector@ should each be prefaced with the appropriate namespace resolution: '@std::@'. ]_
211 38 Kyle Knoepfel
212 1 Kyle Knoepfel
|{background:#fba}. *@fhiclcpp@ parameter*|{background:#fba}. *Passed argument*|{background:#fba}. *Function call*|
213 1 Kyle Knoepfel
|\3{background:#ddd}. _Simple @fhiclcpp@ parameters_|
214 38 Kyle Knoepfel
|@OptionalAtom<string> label@; |@string l;@| @bool exists = label(l);@|
215 38 Kyle Knoepfel
|@OptionalSequence<int> counts@; | @vector<int> v;@|@bool exists = counts(v);@ |
216 38 Kyle Knoepfel
|@OptionalSequence<double, 3u> point@;| @array<double, 3u> p;@| @bool exists = point(p);@ |
217 38 Kyle Knoepfel
|@OptionalTuple<string, double> assoc;@|@tuple<string, double> t;@| @bool exists = assoc(t);@|
218 36 Kyle Knoepfel
|@OptionalTable<Config> config;@|@Config c;@|@bool exists = config(c);@|
219 14 Kyle Knoepfel
|\3{background:#ddd}. _Nested @fhiclcpp@ parameters_|
220 38 Kyle Knoepfel
|@OptionalSequence< Sequence<int> > datasets;@ |  @vector< vector<int> > sets;@ |@bool exists = datasets(sets);@ |
221 38 Kyle Knoepfel
|@OptionalSequence< Sequence<int>, 2u > twoDatasets;@ |  @array< vector<int>, 2u >@ sets; |@bool exists = twoDatasets(sets);@ |
222 38 Kyle Knoepfel
|@OptionalSequence< Sequence<int, 2u> > intPairs;@ | @vector< array<int, 2u> >@ prs; |@bool exists = intPairs(prs);@ |
223 38 Kyle Knoepfel
|@OptionalSequence< Tuple<string, int, bool> > triplets;@ |  @vector< tuple<string, int, bool> > trps;@ |@bool exists = triplets(trps);@ |
224 38 Kyle Knoepfel
|@OptionalSequence< Table<Config> > manyConfigTables;@ | @vector< Config > tbls;@ |@bool exists = manyConfigTables(tbls);@ |
225 38 Kyle Knoepfel
|@OptionalTuple< string, Table<Config> > configAssoc;@ | @tuple< string, Config > assoc;@ |@bool exists = configAssoc(assoc);@ |
226 38 Kyle Knoepfel
|@OptionalTuple< Tuple<string,bool>, Sequence<int> > awkward;@ | @tuple< tuple<string, bool>, vector<int> > wow;@ |@bool exists = awkward(wow);@ |
227 38 Kyle Knoepfel
228 21 Kyle Knoepfel
229 21 Kyle Knoepfel
----
230 21 Kyle Knoepfel
231 21 Kyle Knoepfel
h1(#table_func). Additional functions for @Table<T>@
232 21 Kyle Knoepfel
233 21 Kyle Knoepfel
The @Table@ template offers a few extra functions that the user can call: 
234 21 Kyle Knoepfel
235 21 Kyle Knoepfel
<pre><code class="cpp">
236 21 Kyle Knoepfel
fhicl::ParameterSet const& get_PSet() const;
237 21 Kyle Knoepfel
238 21 Kyle Knoepfel
void print_allowed_configuration(std::ostream& os,
239 21 Kyle Knoepfel
                                 std::string const& tab = std::string(3,' ') ) const;
240 21 Kyle Knoepfel
241 21 Kyle Knoepfel
// Expert-level functions
242 21 Kyle Knoepfel
void validate_ParameterSet(fhicl::ParameterSet const& pset,
243 21 Kyle Knoepfel
                           std::set<std::string> const& keysToIgnore = {} );
244 21 Kyle Knoepfel
245 21 Kyle Knoepfel
</code></pre>
246 24 Kyle Knoepfel
247 1 Kyle Knoepfel
h3(#get_pset). @get_PSet@
248 28 Kyle Knoepfel
249 24 Kyle Knoepfel
A call to this function returns a @const@ reference to the @ParameterSet@ object that was used to fill the values of the individual @Table@ members.  This is helpful for users who need to interact with the @ParameterSet@ object itself.
250 21 Kyle Knoepfel
251 21 Kyle Knoepfel
h3(#print). @print_allowed_configuration@
252 1 Kyle Knoepfel
253 21 Kyle Knoepfel
For any @Table<Config>@ object, @print_allowed_configuration@ will fill a user-supplied @std::ostream@ object with the allowed configuration as defined by the @Config@ struct.  The optional second argument specifies the number of spaces per indentation.  The default is 3 spaces but is, of course, user-configurable.
254 24 Kyle Knoepfel
255 21 Kyle Knoepfel
----
256 25 Kyle Knoepfel
257 25 Kyle Knoepfel
%{color:red} _[ *N.B.* The following function should not normally be invoked by users. It is meant to be called only in contexts outside of @art@.  Please consult artists@fnal.gov for guidance.]_%
258 17 Kyle Knoepfel
259 14 Kyle Knoepfel
h3(#validate). @validate_ParameterSet@ (expert)
260 14 Kyle Knoepfel
261 14 Kyle Knoepfel
This function is intended for experts who need to validate the @pset@ object themselves.  The @keysToIgnore@ variable represents a set of keys for which the validation step will ignore.  The validation function will ignore any nested keys as well--i.e. if a user specifies an ignorable key as @table1@, the (e.g.) @table1.someAtom@ key would be ignored in addition to just the @table1@ name.  An indexed parameter (e.g.) @seq[1]@ is considered a nested parameter of its parent @seq@.  Providing or not providing the ignorable key in a configuration will lead to no error upon validation of the @ParameterSet@.
262 14 Kyle Knoepfel
263 30 Kyle Knoepfel
Should the validation step fail, an exception is thrown of type @fhicl::detail::validationException@.  This behavior is not currently configurable.
264 14 Kyle Knoepfel
265 14 Kyle Knoepfel
----
266 30 Kyle Knoepfel
267 14 Kyle Knoepfel
h1(#common_acc). Common parameter accessors
268 14 Kyle Knoepfel
269 14 Kyle Knoepfel
Each of the @fhiclcpp@ types has the following accessors:
270 14 Kyle Knoepfel
<pre><code class="cpp">
271 14 Kyle Knoepfel
std::string key()            const;
272 14 Kyle Knoepfel
std::string name()           const;
273 14 Kyle Knoepfel
std::string comment()        const;
274 14 Kyle Knoepfel
bool        has_default()    const;
275 14 Kyle Knoepfel
bool        is_optional()    const;
276 14 Kyle Knoepfel
par_type    parameter_type() const;
277 14 Kyle Knoepfel
</code></pre>
278 14 Kyle Knoepfel
279 17 Kyle Knoepfel
To call these functions, the difference in syntax is crucial:
280 14 Kyle Knoepfel
281 14 Kyle Knoepfel
<pre><code class="cpp">
282 14 Kyle Knoepfel
Atom<int> val { Name("val") };
283 14 Kyle Knoepfel
284 14 Kyle Knoepfel
auto key1 = val.key();   //   correct
285 14 Kyle Knoepfel
auto key2 = val().key(); // ! compile-time ERROR - 'val()' is an int, which has no accessor called 'key()' 
286 14 Kyle Knoepfel
</code></pre>
287 31 Kyle Knoepfel
288 1 Kyle Knoepfel
h2. @key()@
289 30 Kyle Knoepfel
290 14 Kyle Knoepfel
A call to @key()@ returns the _full_ key, including all enclosing tables.  For example, consider a module that is designed to allow the following configuration:
291 30 Kyle Knoepfel
<pre><code class="ruby">
292 1 Kyle Knoepfel
pset: {
293 30 Kyle Knoepfel
  list: [ { particle: electron },
294 30 Kyle Knoepfel
          { particle: muon } ]
295 17 Kyle Knoepfel
}
296 14 Kyle Knoepfel
</code></pre>For a suitably declared set of @fhiclcpp@ parameters, the returned key corresponding to "muon" would be @pset.list[1].particle@.
297 14 Kyle Knoepfel
298 14 Kyle Knoepfel
h2. @name()@
299 17 Kyle Knoepfel
300 14 Kyle Knoepfel
The name is the most-nested name in the key.  For the above "muon" parameter, a key of @pset.list[1].particle@ has a corresponding name of @particle@.  If the parameter in question were @pset.list[1]@, the name would be[1] @list[1]@.
301 1 Kyle Knoepfel
302 1 Kyle Knoepfel
fn1. Technically, this is inaccurate -- sequence elements do not have names.  However, for the sake of parameter identification, a sequence element has a name whose value is the sequence name with the appropriate sequence element index/indices appended.
303 30 Kyle Knoepfel
304 30 Kyle Knoepfel
h2. @comment()@
305 30 Kyle Knoepfel
306 30 Kyle Knoepfel
Returns the comment supplied as the string literal in (e.g.) @Comment("Here is the comment")@.  If no @Comment@ argument is provided in the @fhiclcpp@ parameter constructor, a call to this function returns an empty string.
307 1 Kyle Knoepfel
308 1 Kyle Knoepfel
h2. @has_default()@
309 1 Kyle Knoepfel
310 1 Kyle Knoepfel
Returns @true@ or @false@ depending on whether the user supplied a default value for the parameter.
311 14 Kyle Knoepfel
312 14 Kyle Knoepfel
h2. @is_optional()@
313 30 Kyle Knoepfel
314 30 Kyle Knoepfel
Returns @true@ or @false@ depending on whether the parameter is of an @Optional*@ @fhiclcpp@ type.
315 30 Kyle Knoepfel
316 30 Kyle Knoepfel
h2. @parameter_type()@
317 30 Kyle Knoepfel
318 14 Kyle Knoepfel
Returns an enumeration value based on the parameter type:
319 14 Kyle Knoepfel
320 14 Kyle Knoepfel
<pre><code class="cpp">
321 1 Kyle Knoepfel
enum class par_type {
322 1 Kyle Knoepfel
  ATOM,        // (Optional)Atom<T>
323 1 Kyle Knoepfel
  TABLE,       // (Optional)Table<T>
324 1 Kyle Knoepfel
  SEQ_VECTOR,  // (Optional)Sequence<T>
325 1 Kyle Knoepfel
  SEQ_ARRAY,   // (Optional)Sequence<T,std::size_t>
326 1 Kyle Knoepfel
  TUPLE,       // (Optional)Tuple<T...>
327 1 Kyle Knoepfel
  NTYPES       // Signifies invalid parameter 
328 1 Kyle Knoepfel
};
329 1 Kyle Knoepfel
</code></pre>