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 = "",
11  const std::string& file = "")
12  {
13  if (!condition)
14  error("Check failed: " + tToString(message), line, function, file);
15  }
16 
17  template<typename T, typename T1, typename T2>
18  void checkE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
19  const std::string& function = "", const std::string& file = "")
20  {
21  if (conditionA != conditionB)
22  error("CheckE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
23  + tToString(message), line, function, file);
24  }
25 
26  template<typename T, typename T1, typename T2>
27  void checkNE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
28  const std::string& function = "", const std::string& file = "")
29  {
30  if (conditionA == conditionB)
31  error("CheckNE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
32  + tToString(message), line, function, file);
33  }
34 
35  template<typename T, typename T1, typename T2>
36  void checkLE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
37  const std::string& function = "", const std::string& file = "")
38  {
39  if (conditionA > conditionB)
40  error("CheckLE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
41  + tToString(message), line, function, file);
42  }
43 
44  template<typename T, typename T1, typename T2>
45  void checkLT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
46  const std::string& function = "", const std::string& file = "")
47  {
48  if (conditionA >= conditionB)
49  error("CheckLT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
50  + tToString(message), line, function, file);
51  }
52 
53  template<typename T, typename T1, typename T2>
54  void checkGE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
55  const std::string& function = "", const std::string& file = "")
56  {
57  if (conditionA < conditionB)
58  error("CheckGE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
59  + tToString(message), line, function, file);
60  }
61 
62  template<typename T, typename T1, typename T2>
63  void checkGT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1,
64  const std::string& function = "", const std::string& file = "")
65  {
66  if (conditionA <= conditionB)
67  error("CheckGT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): "
68  + tToString(message), line, function, file);
69  }
70 }
71 
72 #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:45
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:27
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:54
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:18
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:36
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:63
std::string string
Definition: cl2.hpp:574