1use std::collections::HashMap;
2
3use crate::func::FuncMatcher;
4use crate::SupportedModule;
5
6pub type FuncUnsafe = FuncMatcher<'static, ()>;
7
8pub fn func_unsafe_factory(module: SupportedModule) -> FuncUnsafe {
10 match module {
11 SupportedModule::Core => core_factory(),
12 SupportedModule::Dnn => dnn_factory(),
13 _ => FuncUnsafe::empty(),
14 }
15}
16
17fn core_factory() -> FuncUnsafe {
18 FuncMatcher::create(HashMap::from([
19 (
21 "cv::Mat::Mat",
22 vec![
23 (pred!(mut, ["size", "type"]), ()),
24 (pred!(mut, ["sizes", "type"]), ()),
25 (pred!(mut, ["ndims", "sizes", "type"]), ()),
26 (pred!(mut, ["rows", "cols", "type"]), ()),
27 ],
28 ),
29 (
30 "cv::Mat::create",
31 vec![
32 (pred!(mut, ["size", "type"]), ()),
33 (pred!(mut, ["sizes", "type"]), ()),
34 (pred!(mut, ["ndims", "sizes", "type"]), ()),
35 (pred!(mut, ["rows", "cols", "type"]), ()),
36 ],
37 ),
38 (
39 "cv::UMat::UMat",
40 vec![
41 (pred!(mut, ["size", "type", "usageFlags"]), ()),
42 (pred!(mut, ["ndims", "sizes", "type", "usageFlags"]), ()),
43 (pred!(mut, ["rows", "cols", "type", "usageFlags"]), ()),
44 ],
45 ),
46 (
47 "cv::UMat::create",
48 vec![
49 (pred!(mut, ["size", "type", "usageFlags"]), ()),
50 (pred!(mut, ["size", "type", "usageFlags"]), ()),
51 (pred!(mut, ["ndims", "sizes", "type", "usageFlags"]), ()),
52 (pred!(mut, ["sizes", "type", "usageFlags"]), ()),
53 (pred!(mut, ["rows", "cols", "type", "usageFlags"]), ()),
54 ],
55 ),
56 ("cv::_OutputArray::createSameSize", vec![(pred!(const, ["arr", "mtype"]), ())]),
57 ("cv::MatStep::operator[]", vec![(pred!(["i"], ["int"]), ())]),
59 ("cv::Mat::addref", vec![(pred!(mut, []), ())]),
61 ("cv::Mat::release", vec![(pred!(mut, []), ())]),
62 ("cv::SparseMat::addref", vec![(pred!(mut, []), ())]),
63 ("cv::SparseMat::release", vec![(pred!(mut, []), ())]),
64 ("cv::UMat::addref", vec![(pred!(mut, []), ())]),
65 ("cv::UMat::release", vec![(pred!(mut, []), ())]),
66 (
68 "cv::cuda::GpuMat::GpuMat",
69 vec![
70 (pred!(mut, ["allocator"]), ()),
71 (pred!(mut, ["size", "type", "allocator"]), ()),
72 (pred!(mut, ["size", "type", "s", "allocator"]), ()),
73 (pred!(mut, ["arr", "allocator"]), ()),
74 (pred!(mut, ["rows", "cols", "type", "allocator"]), ()),
75 (pred!(mut, ["rows", "cols", "type", "s", "allocator"]), ()),
76 ],
77 ),
78 ]))
79}
80
81fn dnn_factory() -> FuncUnsafe {
82 FuncMatcher::create(HashMap::from([
83 ("cv::dnn::Dict::ptr", vec![(pred!(["key"]), ())]),
85 ]))
86}