Bridge++
Ver. 2.0.2
parameterManager.cpp
Go to the documentation of this file.
1
14
#include "
parameterManager_YAML.h
"
15
16
#ifdef USE_XML
17
#include "
parameterManager_XML.h
"
18
#endif
19
20
const
std::string
ParameterManager::class_name
=
"ParameterManager"
;
21
22
//====================================================================
23
Parameters
ParameterManager::read
(
const
std::string& params_file)
24
{
25
Parameters
params;
26
27
read
(params_file, params);
28
return
params;
29
}
30
31
32
//====================================================================
33
void
ParameterManager::read
(
const
std::string& params_file,
Parameters
& params)
34
{
35
if
(params_file.size() == 0)
return
;
36
37
vout
.
general
(
"file = %s\n"
, params_file.c_str());
38
39
std::string ext = params_file.substr(params_file.find_last_of(
'.'
));
40
41
vout
.
paranoiac
(
"ext = %s\n"
, ext.c_str());
42
43
if
(ext ==
".yaml"
) {
44
ParameterManager_YAML
().
read_params
(params_file, params);
45
#ifdef USE_XML
46
}
else
if
(ext ==
".xml"
) {
47
ParameterManager_XML().read_params(params_file, params);
48
#endif
49
}
else
{
50
vout
.
crucial
(
"Error at %s: unrecognized file type: %s\n"
,
class_name
.c_str(), params_file.c_str());
51
exit(EXIT_FAILURE);
52
}
53
}
54
55
56
//============================================================END=====
Parameters
Class for parameters.
Definition:
parameters.h:46
Bridge::BridgeIO::paranoiac
void paranoiac(const char *format,...)
Definition:
bridgeIO.cpp:238
parameterManager_YAML.h
ParameterManager::class_name
static const std::string class_name
Definition:
parameterManager.h:31
ParameterManager::read
static void read(const std::string ¶ms_file, Parameters ¶ms)
Definition:
parameterManager.cpp:33
ParameterManager_YAML
Parameter manager with YAML parser.
Definition:
parameterManager_YAML.h:28
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition:
bridgeIO.cpp:180
ParameterManager_YAML::read_params
void read_params(const std::string ¶ms_file, Parameters ¶ms)
read parameters from file.
Definition:
parameterManager_YAML.cpp:528
Bridge::BridgeIO::general
void general(const char *format,...)
Definition:
bridgeIO.cpp:200
Bridge::vout
BridgeIO vout
Definition:
bridgeIO.cpp:512
parameterManager_XML.h
src
lib
Parameters
parameterManager.cpp
Generated on Sat Feb 10 2024 14:20:00 for Bridge++ by
1.8.17