use std::collections::HashMap;
use crate::func::FuncMatcher;
use crate::SupportedModule;
pub type FuncUnsafe = FuncMatcher<'static, ()>;
pub fn func_unsafe_factory(module: SupportedModule) -> FuncUnsafe {
match module {
SupportedModule::Core => core_factory(),
SupportedModule::Dnn => dnn_factory(),
_ => FuncUnsafe::empty(),
}
}
fn core_factory() -> FuncUnsafe {
FuncMatcher::create(HashMap::from([
(
"cv::Mat::Mat",
vec![
(pred!(mut, ["size", "type"]), ()),
(pred!(mut, ["sizes", "type"]), ()),
(pred!(mut, ["ndims", "sizes", "type"]), ()),
(pred!(mut, ["rows", "cols", "type"]), ()),
],
),
(
"cv::Mat::create",
vec![
(pred!(mut, ["size", "type"]), ()),
(pred!(mut, ["sizes", "type"]), ()),
(pred!(mut, ["ndims", "sizes", "type"]), ()),
(pred!(mut, ["rows", "cols", "type"]), ()),
],
),
(
"cv::UMat::UMat",
vec![
(pred!(mut, ["size", "type", "usageFlags"]), ()),
(pred!(mut, ["ndims", "sizes", "type", "usageFlags"]), ()),
(pred!(mut, ["rows", "cols", "type", "usageFlags"]), ()),
],
),
(
"cv::UMat::create",
vec![
(pred!(mut, ["size", "type", "usageFlags"]), ()),
(pred!(mut, ["size", "type", "usageFlags"]), ()),
(pred!(mut, ["ndims", "sizes", "type", "usageFlags"]), ()),
(pred!(mut, ["sizes", "type", "usageFlags"]), ()),
(pred!(mut, ["rows", "cols", "type", "usageFlags"]), ()),
],
),
("cv::_OutputArray::createSameSize", vec![(pred!(const, ["arr", "mtype"]), ())]),
("cv::MatStep::operator[]", vec![(pred!(["i"], ["int"]), ())]),
("cv::Mat::addref", vec![(pred!(mut, []), ())]),
("cv::Mat::release", vec![(pred!(mut, []), ())]),
("cv::SparseMat::addref", vec![(pred!(mut, []), ())]),
("cv::SparseMat::release", vec![(pred!(mut, []), ())]),
("cv::UMat::addref", vec![(pred!(mut, []), ())]),
("cv::UMat::release", vec![(pred!(mut, []), ())]),
(
"cv::cuda::GpuMat::GpuMat",
vec![
(pred!(mut, ["allocator"]), ()),
(pred!(mut, ["size", "type", "allocator"]), ()),
(pred!(mut, ["size", "type", "s", "allocator"]), ()),
(pred!(mut, ["arr", "allocator"]), ()),
(pred!(mut, ["rows", "cols", "type", "allocator"]), ()),
(pred!(mut, ["rows", "cols", "type", "s", "allocator"]), ()),
],
),
]))
}
fn dnn_factory() -> FuncUnsafe {
FuncMatcher::create(HashMap::from([
("cv::dnn::Dict::ptr", vec![(pred!(["key"]), ())]),
]))
}