Skip to content

Commit

Permalink
Merge pull request #4 from rainyl/universal-api
Browse files Browse the repository at this point in the history
remove callbacks for cv_Mat_op
  • Loading branch information
rainyl authored Oct 18, 2024
2 parents a97fa24 + a2cc188 commit 5ba2ef5
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 167 deletions.
160 changes: 32 additions & 128 deletions dartcv/core/mat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,267 +833,171 @@ void cv_Mat_set_Vec6d(Mat self, int i0, int i1, Vec6d val) {
cv::Vec6d(val.val1, val.val2, val.val3, val.val4, val.val5, val.val6);
}

CvStatus* cv_Mat_op_add_mat(Mat self, Mat val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_mat(Mat self, Mat val) {
BEGIN_WRAP
CVDEREF(self) += CVDEREF(val);
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_mat(Mat self, Mat val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_mat(Mat self, Mat val) {
BEGIN_WRAP
CVDEREF(self) -= CVDEREF(val);
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_mat(Mat self, Mat val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_mat(Mat self, Mat val) {
BEGIN_WRAP
CVDEREF(self) *= CVDEREF(val);
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_mat(Mat self, Mat val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_mat(Mat self, Mat val) {
BEGIN_WRAP
CVDEREF(self) /= CVDEREF(val);
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_u8(Mat self, uint8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_u8(Mat self, uint8_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_u8(Mat self, uint8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_u8(Mat self, uint8_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_u8(Mat self, uint8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_u8(Mat self, uint8_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_u8(Mat self, uint8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_u8(Mat self, uint8_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_i8(Mat self, int8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_i8(Mat self, int8_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_i8(Mat self, int8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_i8(Mat self, int8_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_i8(Mat self, int8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_i8(Mat self, int8_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_i8(Mat self, int8_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_i8(Mat self, int8_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_i16(Mat self, int16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_i16(Mat self, int16_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_i16(Mat self, int16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_i16(Mat self, int16_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_i16(Mat self, int16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_i16(Mat self, int16_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_i16(Mat self, int16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_i16(Mat self, int16_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_u16(Mat self, uint16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_u16(Mat self, uint16_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_u16(Mat self, uint16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_u16(Mat self, uint16_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_u16(Mat self, uint16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_u16(Mat self, uint16_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_u16(Mat self, uint16_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_u16(Mat self, uint16_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_i32(Mat self, int32_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_i32(Mat self, int32_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_i32(Mat self, int32_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_i32(Mat self, int32_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_i32(Mat self, int32_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_i32(Mat self, int32_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_i32(Mat self, int32_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_i32(Mat self, int32_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_f32(Mat self, float_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_f32(Mat self, float_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_f32(Mat self, float_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_f32(Mat self, float_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_f32(Mat self, float_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_f32(Mat self, float_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_f32(Mat self, float_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_f32(Mat self, float_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

CvStatus* cv_Mat_op_add_f64(Mat self, double_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_add_f64(Mat self, double_t val) {
BEGIN_WRAP
CVDEREF(self) += val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_sub_f64(Mat self, double_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_sub_f64(Mat self, double_t val) {
BEGIN_WRAP
CVDEREF(self) -= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_mul_f64(Mat self, double_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_mul_f64(Mat self, double_t val) {
BEGIN_WRAP
CVDEREF(self) *= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}
CvStatus* cv_Mat_op_div_f64(Mat self, double_t val, CvCallback_0 callback) {
CvStatus* cv_Mat_op_div_f64(Mat self, double_t val) {
BEGIN_WRAP
CVDEREF(self) /= val;
if (callback != nullptr) {
callback();
}
END_WRAP
}

Expand Down
78 changes: 39 additions & 39 deletions dartcv/core/mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,45 +285,45 @@ void cv_Mat_set_Vec3d(Mat self, int i0, int i1, Vec3d val);
void cv_Mat_set_Vec4d(Mat self, int i0, int i1, Vec4d val);
void cv_Mat_set_Vec6d(Mat self, int i0, int i1, Vec6d val);

CvStatus* cv_Mat_op_add_mat(Mat self, Mat val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_mat(Mat self, Mat val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_mat(Mat self, Mat val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_mat(Mat self, Mat val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_u8(Mat self, uint8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_u8(Mat self, uint8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_u8(Mat self, uint8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_u8(Mat self, uint8_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_i8(Mat self, int8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_i8(Mat self, int8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_i8(Mat self, int8_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_i8(Mat self, int8_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_i16(Mat self, int16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_i16(Mat self, int16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_i16(Mat self, int16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_i16(Mat self, int16_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_u16(Mat self, uint16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_u16(Mat self, uint16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_u16(Mat self, uint16_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_u16(Mat self, uint16_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_i32(Mat self, int32_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_i32(Mat self, int32_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_i32(Mat self, int32_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_i32(Mat self, int32_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_f32(Mat self, float_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_f32(Mat self, float_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_f32(Mat self, float_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_f32(Mat self, float_t val, CvCallback_0 callback);

CvStatus* cv_Mat_op_add_f64(Mat self, double_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_sub_f64(Mat self, double_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_mul_f64(Mat self, double_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_div_f64(Mat self, double_t val, CvCallback_0 callback);
CvStatus* cv_Mat_op_add_mat(Mat self, Mat val);
CvStatus* cv_Mat_op_sub_mat(Mat self, Mat val);
CvStatus* cv_Mat_op_mul_mat(Mat self, Mat val);
CvStatus* cv_Mat_op_div_mat(Mat self, Mat val);

CvStatus* cv_Mat_op_add_u8(Mat self, uint8_t val);
CvStatus* cv_Mat_op_sub_u8(Mat self, uint8_t val);
CvStatus* cv_Mat_op_mul_u8(Mat self, uint8_t val);
CvStatus* cv_Mat_op_div_u8(Mat self, uint8_t val);

CvStatus* cv_Mat_op_add_i8(Mat self, int8_t val);
CvStatus* cv_Mat_op_sub_i8(Mat self, int8_t val);
CvStatus* cv_Mat_op_mul_i8(Mat self, int8_t val);
CvStatus* cv_Mat_op_div_i8(Mat self, int8_t val);

CvStatus* cv_Mat_op_add_i16(Mat self, int16_t val);
CvStatus* cv_Mat_op_sub_i16(Mat self, int16_t val);
CvStatus* cv_Mat_op_mul_i16(Mat self, int16_t val);
CvStatus* cv_Mat_op_div_i16(Mat self, int16_t val);

CvStatus* cv_Mat_op_add_u16(Mat self, uint16_t val);
CvStatus* cv_Mat_op_sub_u16(Mat self, uint16_t val);
CvStatus* cv_Mat_op_mul_u16(Mat self, uint16_t val);
CvStatus* cv_Mat_op_div_u16(Mat self, uint16_t val);

CvStatus* cv_Mat_op_add_i32(Mat self, int32_t val);
CvStatus* cv_Mat_op_sub_i32(Mat self, int32_t val);
CvStatus* cv_Mat_op_mul_i32(Mat self, int32_t val);
CvStatus* cv_Mat_op_div_i32(Mat self, int32_t val);

CvStatus* cv_Mat_op_add_f32(Mat self, float_t val);
CvStatus* cv_Mat_op_sub_f32(Mat self, float_t val);
CvStatus* cv_Mat_op_mul_f32(Mat self, float_t val);
CvStatus* cv_Mat_op_div_f32(Mat self, float_t val);

CvStatus* cv_Mat_op_add_f64(Mat self, double_t val);
CvStatus* cv_Mat_op_sub_f64(Mat self, double_t val);
CvStatus* cv_Mat_op_mul_f64(Mat self, double_t val);
CvStatus* cv_Mat_op_div_f64(Mat self, double_t val);

/*
* element-wise
Expand Down

0 comments on commit 5ba2ef5

Please sign in to comment.