Bridge++
Ver. 2.0.2
parameterCheck.cpp
Go to the documentation of this file.
1
14
#include "
parameterCheck.h
"
15
16
namespace
ParameterCheck
17
{
18
Bridge::VerboseLevel
vl
;
19
20
//====================================================================
21
int
non_negative
(
const
int
v)
22
{
23
if
(v < 0) {
24
vout
.
crucial
(
vl
,
"ParameterCheck: range check error, negative int.\n"
);
25
return
EXIT_FAILURE;
26
}
27
return
EXIT_SUCCESS;
28
}
29
30
31
//====================================================================
32
int
non_zero
(
const
double
v)
33
{
34
if
(fabs(v) <
CommonParameters::epsilon_criterion
()) {
35
vout
.
crucial
(
vl
,
"ParameterCheck: range check error, zero double.\n"
);
36
return
EXIT_FAILURE;
37
}
38
return
EXIT_SUCCESS;
39
}
40
41
42
//====================================================================
43
int
square_non_zero
(
const
double
v)
44
{
45
if
(fabs(v) <
CommonParameters::epsilon_criterion2
()) {
46
vout
.
crucial
(
vl
,
"ParameterCheck: range check error, square_zero double.\n"
);
47
return
EXIT_FAILURE;
48
}
49
return
EXIT_SUCCESS;
50
}
51
52
53
//====================================================================
54
int
non_zero
(
const
int
v)
55
{
56
if
(v == 0) {
57
vout
.
crucial
(
vl
,
"ParameterCheck: range check error, zero int.\n"
);
58
return
EXIT_FAILURE;
59
}
60
return
EXIT_SUCCESS;
61
}
62
63
64
//====================================================================
65
int
non_NULL
(
const
std::string v)
66
{
67
if
(v ==
"NULL"
) {
68
vout
.
crucial
(
vl
,
"ParameterCheck: range check error, NULL string.\n"
);
69
return
EXIT_FAILURE;
70
}
71
return
EXIT_SUCCESS;
72
}
73
74
75
//====================================================================
76
int
is_satisfied
(
const
bool
cond)
77
{
78
return
cond ? EXIT_SUCCESS : EXIT_FAILURE;
79
}
80
}
ParameterCheck::non_NULL
int non_NULL(const std::string v)
Definition:
parameterCheck.cpp:65
parameterCheck.h
ParameterCheck::non_negative
int non_negative(const int v)
Definition:
parameterCheck.cpp:21
CommonParameters::epsilon_criterion2
static double epsilon_criterion2()
Definition:
commonParameters.h:120
ParameterCheck::vl
Bridge::VerboseLevel vl
Definition:
parameterCheck.cpp:18
ParameterCheck::is_satisfied
int is_satisfied(const bool cond)
Definition:
parameterCheck.cpp:76
ParameterCheck::square_non_zero
int square_non_zero(const double v)
Definition:
parameterCheck.cpp:43
ParameterCheck
Definition:
parameterCheck.cpp:16
ParameterCheck::non_zero
int non_zero(const double v)
Definition:
parameterCheck.cpp:32
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition:
bridgeIO.cpp:180
Bridge::VerboseLevel
VerboseLevel
Definition:
bridgeIO.h:42
Bridge::vout
BridgeIO vout
Definition:
bridgeIO.cpp:512
CommonParameters::epsilon_criterion
static double epsilon_criterion()
Definition:
commonParameters.h:119
src
lib
Parameters
parameterCheck.cpp
Generated on Sat Feb 10 2024 14:20:00 for Bridge++ by
1.8.17