Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
checker.cpp
Go to the documentation of this file.
1 
14 #include "checker.h"
15 
16 namespace ParameterCheck
17 {
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  int non_zero(const double v)
32  {
33  if (fabs(v) < CommonParameters::epsilon_criterion()) {
34  vout.crucial(vl, "ParameterCheck: range check error, zero double.\n");
35  return EXIT_FAILURE;
36  }
37  return EXIT_SUCCESS;
38  }
39 
40 
41  int square_non_zero(const double v)
42  {
43  if (fabs(v) < CommonParameters::epsilon_criterion2()) {
44  vout.crucial(vl, "ParameterCheck: range check error, square_zero double.\n");
45  return EXIT_FAILURE;
46  }
47  return EXIT_SUCCESS;
48  }
49 
50 
51  int non_zero(const int v)
52  {
53  if (v == 0) {
54  vout.crucial(vl, "ParameterCheck: range check error, zero int.\n");
55  return EXIT_FAILURE;
56  }
57  return EXIT_SUCCESS;
58  }
59 
60 
61  int non_NULL(const std::string v)
62  {
63  if (v == "NULL") {
64  vout.crucial(vl, "ParameterCheck: range check error, NULL string.\n");
65  return EXIT_FAILURE;
66  }
67  return EXIT_SUCCESS;
68  }
69 }
BridgeIO vout
Definition: bridgeIO.cpp:495
static double epsilon_criterion()
int square_non_zero(const double v)
Definition: checker.cpp:41
static double epsilon_criterion2()
int non_NULL(const std::string v)
Definition: checker.cpp:61
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
Bridge::VerboseLevel vl
Definition: checker.cpp:18
VerboseLevel
Definition: bridgeIO.h:42
int non_zero(const double v)
Definition: checker.cpp:31
int non_negative(const int v)
Definition: checker.cpp:21