OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 check(const bool condition, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
11  {
12  if (!condition)
13  error("Check failed: " + tToString(message), line, function, file);
14  }
15 
16  template<typename T, typename T1, typename T2>
17  void checkE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
18  {
19  if (conditionA != conditionB)
20  error("CheckE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
21  }
22 
23  template<typename T, typename T1, typename T2>
24  void checkNE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
25  {
26  if (conditionA == conditionB)
27  error("CheckNE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
28  }
29 
30  template<typename T, typename T1, typename T2>
31  void checkLE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
32  {
33  if (conditionA > conditionB)
34  error("CheckLE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
35  }
36 
37  template<typename T, typename T1, typename T2>
38  void checkLT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
39  {
40  if (conditionA >= conditionB)
41  error("CheckLT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
42  }
43 
44  template<typename T, typename T1, typename T2>
45  void checkGE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
46  {
47  if (conditionA < conditionB)
48  error("CheckGE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
49  }
50 
51  template<typename T, typename T1, typename T2>
52  void checkGT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, const std::string& function = "", const std::string& file = "")
53  {
54  if (conditionA <= conditionB)
55  error("CheckGT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " + tToString(message), line, function, file);
56  }
57 }
58 
59 #endif // OPENPOSE_UTILITIES_CHECK_HPP
void checkLT(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:38
void checkNE(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:24
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
void checkGE(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:45
std::string tToString(const T &message)
Definition: errorAndLog.hpp:15
void checkE(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:17
void check(const bool condition, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:10
void checkLE(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:31
void checkGT(const T1 &conditionA, const T2 &conditionB, const T &message="", const int line=-1, const std::string &function="", const std::string &file="")
Definition: check.hpp:52
std::string string
Definition: cl2.hpp:574