3 #ifndef FORPY_GLOBAL_H_ 4 #define FORPY_GLOBAL_H_ 6 #include <glog/logging.h> 12 #include <gperftools/profiler.h> 15 #if !(defined NDEBUG) && defined(_MSC_VER) 23 inline bool ends_with(std::string
const& value, std::string
const& ending) {
24 if (ending.size() > value.size())
return false;
25 return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
30 #if defined(NDEBUG) || !defined(_MSC_VER) 31 #define VIRTUAL(type) = 0 32 #define VIRTUAL_VOID = 0 33 #define VIRTUAL_PTR = 0 35 #define VIRTUAL(type) \ 40 #define VIRTUAL_VOID \ 54 #define NOASSIGN_BUT_MOVE(TypeName) \ 55 TypeName(const TypeName&) = delete; \ 56 TypeName& operator=(const TypeName&) = delete; \ 57 TypeName(TypeName&&) = default; \ 58 TypeName& operator=(TypeName&&) = default; 60 #define MOVE_ASSIGN(TypeName) \ 61 TypeName(TypeName&&) = default; \ 62 TypeName& operator=(TypeName&&) = default; 64 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ 65 TypeName(const TypeName&); \ 66 TypeName& operator=(const TypeName&); 71 google::InitGoogleLogging(
"");
72 FLAGS_logtostderr = 1;
73 LOG(INFO) <<
"forpy version " << std::setprecision(2) << std::fixed
75 <<
" initialized." << std::defaultfloat;
76 LOG(INFO) <<
"Detected support for " << std::thread::hardware_concurrency()
77 <<
" hardware threads.";
80 #pragma clang diagnostic push 81 #pragma clang diagnostic ignored "-Wunused-variable" 83 #ifdef FORPY_SKLEARN_COMPAT 88 #pragma clang diagnostic pop 95 virtual const char*
what()
const throw() {
return whatstr.c_str(); };
111 #define FBREAKP DebugBreak() 114 #define FBREAKP std::raise(SIGINT) 117 #if defined RUNTIME_CHECKS 118 #define FASSERT(condition) \ 119 if (!(condition)) { \ 120 LOG(ERROR) << "Assertion failed!"; \ 124 #define FASSERT(condition) 128 #if !defined(_MSC_VER) 130 #elif __BUILD_FORPY_LIBRARY 131 #define DllExport __declspec(dllexport) 133 #define DllExport __declspec(dllimport) 136 #ifdef __BUILD_FORPY_LIBRARY 137 #define TemplateExport template class 138 #define TemplateFuncExport template 141 #define TemplateExport extern template class 142 #define TemplateFuncExport extern template 143 #define ExportVar extern 146 #pragma clang diagnostic push 147 #pragma clang diagnostic ignored "-Wunused-function" 153 #pragma clang diagnostic pop 154 #endif // FORPY_GLOBAL_H_ virtual ~ForpyException()
static bool FORPY_OPENCV_AVAILABLE()
static unsigned int FORPY_LIB_VERSION()
virtual const char * what() const
ForpyException(const std::string &what)
static const bool SKLEARN_COMPAT
bool ends_with(std::string const &value, std::string const &ending)
const std::string whatstr