Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
fhiclcpp
fhiclcpp
test
to_indented_string_annotated_test.cc
Go to the documentation of this file.
1
// ======================================================================
2
//
3
// test of to_indented_string with annotations
4
//
5
// ======================================================================
6
7
#include "
cetlib/filepath_maker.h
"
8
#include "
fhiclcpp/ParameterSet.h
"
9
#include "
fhiclcpp/intermediate_table.h
"
10
#include "
fhiclcpp/parse.h
"
11
12
#include <cstdlib>
13
#include <iostream>
14
#include <string>
15
16
int
17
main
()
18
{
19
20
// Configuration file lookup policy.
21
char
const
* fhicl_env =
getenv
(
"FHICL_FILE_PATH"
);
22
std::string
search_path;
23
if
(fhicl_env ==
nullptr
) {
24
std::cerr <<
"Expected environment variable FHICL_FILE_PATH is "
25
<<
"missing or empty: using \".\"\n"
;
26
search_path =
".:"
;
27
}
else
{
28
search_path =
std::string
(fhicl_env) +
":"
;
29
}
30
31
cet::filepath_lookup
policy(search_path);
32
std::string
const
in{
"to_indented_string_annotated_test.fcl"
};
33
34
auto
const
tbl =
fhicl::parse_document
(in, policy);
35
auto
pset =
fhicl::ParameterSet::make
(tbl);
36
37
pset.put<
int
>(
"another_number"
, 4);
38
pset.put_or_replace<
int
>(
"some_number"
, 8);
39
pset.put_or_replace<
double
>(
"double"
, 234.6);
40
41
std::cout << pset.to_indented_string(0,
true
) <<
std::endl
;
42
}
intermediate_table.h
string
std::string string
Definition:
nybbler.cc:12
fhicl::ParameterSet::make
static ParameterSet make(intermediate_table const &tbl)
Definition:
ParameterSet.cc:68
main
int main()
Definition:
to_indented_string_annotated_test.cc:17
parse.h
ParameterSet.h
cet::filepath_lookup
Definition:
filepath_maker.h:52
cet::getenv
std::string getenv(std::string const &name)
Definition:
getenv.cc:15
filepath_maker.h
fhicl::parse_document
intermediate_table parse_document(std::string const &filename, cet::filepath_maker &maker)
Definition:
parse.cc:720
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11