mirror of
https://github.com/opencv/opencv.git
synced 2024-12-27 11:28:14 +08:00
53 lines
1.0 KiB
Plaintext
53 lines
1.0 KiB
Plaintext
|
//
|
||
|
// This file is auto-generated. Please don't modify it!
|
||
|
//
|
||
|
|
||
|
#undef LOG_TAG
|
||
|
|
||
|
#include "opencv2/opencv_modules.hpp"
|
||
|
#ifdef HAVE_OPENCV_$M
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
#include "opencv2/$m.hpp"
|
||
|
|
||
|
$includes
|
||
|
|
||
|
#define LOG_TAG "org.opencv.$m"
|
||
|
#include "common.h"
|
||
|
|
||
|
using namespace cv;
|
||
|
|
||
|
/// throw java exception
|
||
|
#undef throwJavaException
|
||
|
#define throwJavaException throwJavaException_$m
|
||
|
static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
|
||
|
std::string what = "unknown exception";
|
||
|
jclass je = 0;
|
||
|
|
||
|
if(e) {
|
||
|
std::string exception_type = "std::exception";
|
||
|
|
||
|
if(dynamic_cast<const cv::Exception*>(e)) {
|
||
|
exception_type = "cv::Exception";
|
||
|
je = env->FindClass("org/opencv/core/CvException");
|
||
|
}
|
||
|
|
||
|
what = exception_type + ": " + e->what();
|
||
|
}
|
||
|
|
||
|
if(!je) je = env->FindClass("java/lang/Exception");
|
||
|
env->ThrowNew(je, what.c_str());
|
||
|
|
||
|
LOGE("%s caught %s", method, what.c_str());
|
||
|
(void)method; // avoid "unused" warning
|
||
|
}
|
||
|
|
||
|
extern "C" {
|
||
|
|
||
|
$code
|
||
|
|
||
|
} // extern "C"
|
||
|
|
||
|
#endif // HAVE_OPENCV_$M
|