| | #ifndef OPENPOSE_UTILITIES_ERROR_AND_LOG_HPP |
| | #define OPENPOSE_UTILITIES_ERROR_AND_LOG_HPP |
| |
|
| | #include <sstream> |
| | #include <string> |
| | #include <vector> |
| | #include <openpose/core/macros.hpp> |
| | #include <openpose/utilities/enumClasses.hpp> |
| |
|
| | namespace op |
| | { |
| | OP_API void setMainThread(); |
| |
|
| | OP_API std::string getThreadId(); |
| |
|
| | OP_API bool getIfInMainThreadOrEmpty(); |
| |
|
| | OP_API bool getIfNotInMainThreadOrEmpty(); |
| |
|
| | template<typename T> |
| | std::string tToString(const T& message) |
| | { |
| | |
| | std::ostringstream oss; |
| | oss << message; |
| | |
| | return oss.str(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | OP_API void error( |
| | const std::string& message, const int line = -1, const std::string& function = "", |
| | const std::string& file = ""); |
| |
|
| | template<typename T> |
| | inline void error( |
| | const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") |
| | { |
| | error(tToString(message), line, function, file); |
| | } |
| |
|
| | |
| | OP_API void checkWorkerErrors(); |
| |
|
| | OP_API void errorWorker( |
| | const std::string& message, const int line = -1, const std::string& function = "", |
| | const std::string& file = ""); |
| |
|
| | template<typename T> |
| | inline void errorWorker( |
| | const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") |
| | { |
| | errorWorker(tToString(message), line, function, file); |
| | } |
| |
|
| | |
| | OP_API void errorDestructor( |
| | const std::string& message, const int line = -1, const std::string& function = "", |
| | const std::string& file = ""); |
| |
|
| | template<typename T> |
| | inline void errorDestructor( |
| | const T& message, const int line = -1, const std::string& function = "", const std::string& file = "") |
| | { |
| | errorDestructor(tToString(message), line, function, file); |
| | } |
| |
|
| | |
| | |
| | |
| | OP_API void opLog( |
| | const std::string& message, const Priority priority = Priority::Max, const int line = -1, |
| | const std::string& function = "", const std::string& file = ""); |
| |
|
| | template<typename T> |
| | inline void opLog( |
| | const T& message, const Priority priority = Priority::Max, const int line = -1, |
| | const std::string& function = "", const std::string& file = "") |
| | { |
| | opLog(tToString(message), priority, line, function, file); |
| | } |
| |
|
| | |
| | |
| | |
| | template<typename T> |
| | inline void opLogIfDebug( |
| | const T& message, const Priority priority = Priority::Max, const int line = -1, |
| | const std::string& function = "", const std::string& file = "") |
| | { |
| | #ifndef NDEBUG |
| | opLog(message, priority, line, function, file); |
| | #else |
| | UNUSED(message); |
| | UNUSED(priority); |
| | UNUSED(line); |
| | UNUSED(function); |
| | UNUSED(file); |
| | #endif |
| | } |
| |
|
| | |
| | namespace ConfigureError |
| | { |
| | OP_API std::vector<ErrorMode> getErrorModes(); |
| |
|
| | OP_API void setErrorModes(const std::vector<ErrorMode>& errorModes); |
| | } |
| |
|
| | |
| | namespace ConfigureLog |
| | { |
| | OP_API Priority getPriorityThreshold(); |
| |
|
| | OP_API const std::vector<LogMode>& getLogModes(); |
| |
|
| | |
| | OP_API void setPriorityThreshold(const Priority priorityThreshold); |
| |
|
| | |
| | OP_API void setLogModes(const std::vector<LogMode>& loggingModes); |
| | } |
| | } |
| |
|
| | #endif |
| |
|