FEI
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
base
fei_ParameterSet.cpp
1
/*--------------------------------------------------------------------*/
2
/* Copyright 2005 Sandia Corporation. */
3
/* Under the terms of Contract DE-AC04-94AL85000, there is a */
4
/* non-exclusive license for use of this work by or on behalf */
5
/* of the U.S. Government. Export of this program may require */
6
/* a license from the United States Government. */
7
/*--------------------------------------------------------------------*/
8
9
#include <fei_macros.hpp>
10
#include <fei_ParameterSet.hpp>
11
12
fei::ParameterSet::ParameterSet
()
13
: params_(NULL)
14
{
15
params_ =
new
std::vector<const Param*>;
16
}
17
18
fei::ParameterSet::~ParameterSet
()
19
{
20
const_iterator
iter =
begin
(), iter_end =
end
();
21
for
(; iter != iter_end; ++iter) {
22
delete
&(*iter);
23
}
24
25
delete
params_; params_ = NULL;
26
}
27
28
int
fei::ParameterSet::getIntParamValue
(
const
char
* name,
29
int
& paramValue)
const
30
{
31
const
fei::Param
* param =
get
(name);
32
if
(param == NULL)
return
(-1);
33
34
if
(param->
getType
() != fei::Param::INT)
return
(-1);
35
36
paramValue = param->
getIntValue
();
37
return
(0);
38
}
39
40
int
fei::ParameterSet::getDoubleParamValue
(
const
char
* name,
41
double
& paramValue)
const
42
{
43
const
fei::Param
* param =
get
(name);
44
if
(param == NULL)
return
(-1);
45
46
if
(param->
getType
() == fei::Param::INT) {
47
paramValue = param->
getIntValue
();
48
}
49
else
if
(param->
getType
() == fei::Param::DOUBLE) {
50
paramValue = param->
getDoubleValue
();
51
}
52
else
return
(-1);
53
54
return
(0);
55
}
56
57
int
fei::ParameterSet::getStringParamValue
(
const
char
* name,
58
std::string& paramValue)
const
59
{
60
const
fei::Param
* param =
get
(name);
61
if
(param == NULL)
return
(-1);
62
63
if
(param->
getType
() != fei::Param::STRING)
return
(-1);
64
65
paramValue = param->
getStringValue
();
66
return
(0);
67
}
68
69
int
fei::ParameterSet::getBoolParamValue
(
const
char
* name,
70
bool
& paramValue)
const
71
{
72
const
fei::Param
* param =
get
(name);
73
if
(param == NULL)
return
(-1);
74
75
if
(param->
getType
() != fei::Param::BOOL)
return
(-1);
76
77
paramValue = param->
getBoolValue
();
78
return
(0);
79
}
80
81
int
fei::ParameterSet::getVoidParamValue
(
const
char
* name,
82
const
void
*& paramValue)
const
83
{
84
const
fei::Param
* param =
get
(name);
85
if
(param == NULL)
return
(-1);
86
87
if
(param->
getType
() != fei::Param::VOID)
return
(-1);
88
89
paramValue = param->
getVoidValue
();
90
return
(0);
91
}
fei::Param
Definition
fei_Param.hpp:23
fei::Param::getStringValue
const std::string & getStringValue() const
Definition
fei_Param.hpp:104
fei::Param::getDoubleValue
double getDoubleValue() const
Definition
fei_Param.hpp:110
fei::Param::getType
ParamType getType() const
Definition
fei_Param.hpp:98
fei::Param::getBoolValue
bool getBoolValue() const
Definition
fei_Param.hpp:122
fei::Param::getVoidValue
const void * getVoidValue() const
Definition
fei_Param.hpp:128
fei::Param::getIntValue
int getIntValue() const
Definition
fei_Param.hpp:116
fei::ParameterSet::const_iterator
Definition
fei_ParameterSet.hpp:82
fei::ParameterSet::ParameterSet
ParameterSet()
Definition
fei_ParameterSet.cpp:12
fei::ParameterSet::~ParameterSet
virtual ~ParameterSet()
Definition
fei_ParameterSet.cpp:18
fei::ParameterSet::getIntParamValue
int getIntParamValue(const char *name, int ¶mValue) const
Definition
fei_ParameterSet.cpp:28
fei::ParameterSet::getVoidParamValue
int getVoidParamValue(const char *name, const void *¶mValue) const
Definition
fei_ParameterSet.cpp:81
fei::ParameterSet::get
const Param * get(const char *name) const
Definition
fei_ParameterSet.hpp:260
fei::ParameterSet::end
const_iterator end() const
Definition
fei_ParameterSet.hpp:229
fei::ParameterSet::begin
const_iterator begin() const
Definition
fei_ParameterSet.hpp:223
fei::ParameterSet::getStringParamValue
int getStringParamValue(const char *name, std::string ¶mValue) const
Definition
fei_ParameterSet.cpp:57
fei::ParameterSet::getDoubleParamValue
int getDoubleParamValue(const char *name, double ¶mValue) const
Definition
fei_ParameterSet.cpp:40
fei::ParameterSet::getBoolParamValue
int getBoolParamValue(const char *name, bool ¶mValue) const
Definition
fei_ParameterSet.cpp:69
Generated by
1.17.0