cpp_module.template 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #undef LOG_TAG
  5. #include "opencv2/opencv_modules.hpp"
  6. #ifdef HAVE_OPENCV_$M
  7. #include <string>
  8. #include "opencv2/$m.hpp"
  9. $includes
  10. #define LOG_TAG "org.opencv.$m"
  11. #include "common.h"
  12. using namespace cv;
  13. /// throw java exception
  14. #undef throwJavaException
  15. #define throwJavaException throwJavaException_$m
  16. static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
  17. std::string what = "unknown exception";
  18. jclass je = 0;
  19. if(e) {
  20. std::string exception_type = "std::exception";
  21. if(dynamic_cast<const cv::Exception*>(e)) {
  22. exception_type = "cv::Exception";
  23. je = env->FindClass("org/opencv/core/CvException");
  24. }
  25. what = exception_type + ": " + e->what();
  26. }
  27. if(!je) je = env->FindClass("java/lang/Exception");
  28. env->ThrowNew(je, what.c_str());
  29. LOGE("%s caught %s", method, what.c_str());
  30. (void)method; // avoid "unused" warning
  31. }
  32. extern "C" {
  33. $code
  34. } // extern "C"
  35. #endif // HAVE_OPENCV_$M