OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
check.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_UTILITIES_CHECK_HPP
2 #define OPENPOSE_UTILITIES_CHECK_HPP
3 
5 
6 namespace op
7 {
8  // CHECK, CHECK_EQ, CHECK_NE, CHECK_LE, CHECK_LT, CHECK_GE, and CHECK_GT
9  template<typename T>
10  void checkBool(
11  const bool condition, const T& message = "", const int line = -1, const std::string& function = "",
12  const std::string& file = "")
13  {
14  if (!condition)
15  error("Check failed: " + tToString(message), line, function, file);
16  }
17 
18  template<typename T, typename T1, typename T2>
19  void checkEqual(
20  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
21  const std::string& function = "", const std::string& file = "")
22  {
23  if (conditionA != conditionB)
24  error("CheckE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
25  + tToString(message), line, function, file);
26  }
27 
28  template<typename T, typename T1, typename T2>
30  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
31  const std::string& function = "", const std::string& file = "")
32  {
33  if (conditionA == conditionB)
34  error("CheckNE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
35  + tToString(message), line, function, file);
36  }
37 
38  template<typename T, typename T1, typename T2>
40  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
41  const std::string& function = "", const std::string& file = "")
42  {
43  if (conditionA > conditionB)
44  error("CheckLE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
45  + tToString(message), line, function, file);
46  }
47 
48  template<typename T, typename T1, typename T2>
50  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
51  const std::string& function = "", const std::string& file = "")
52  {
53  if (conditionA >= conditionB)
54  error("CheckLT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
55  + tToString(message), line, function, file);
56  }
57 
58  template<typename T, typename T1, typename T2>
60  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
61  const std::string& function = "", const std::string& file = "")
62  {
63  if (conditionA < conditionB)
64  error("CheckGE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
65  + tToString(message), line, function, file);
66  }
67 
68  template<typename T, typename T1, typename T2>
70  const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
71  const std::string& function = "", const std::string& file = "")
72  {
73  if (conditionA <= conditionB)
74  error("CheckGT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
75  + tToString(message), line, function, file);
76  }
77 }
78 
79 #endif // OPENPOSE_UTILITIES_CHECK_HPP
void checkLessThan(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:49
void checkGreaterThan(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:69
void checkBool(const bool condition, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:10
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
void checkLessOrEqual(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:39
void checkGreaterOrEqual(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:59
void checkNotEqual(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:29
void checkEqual(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:19
std::string tToString(const T &message)
Definition: errorAndLog.hpp:21