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::Mat::addref", vec![(pred!(mut, []), ())]),
59 ("cv::Mat::release", vec![(pred!(mut, []), ())]),
60 ("cv::SparseMat::addref", vec![(pred!(mut, []), ())]),
61 ("cv::SparseMat::release", vec![(pred!(mut, []), ())]),
62 ("cv::UMat::addref", vec![(pred!(mut, []), ())]),
63 ("cv::UMat::release", vec![(pred!(mut, []), ())]),
64 (
66 "cv::cuda::GpuMat::GpuMat",
67 vec![
68 (pred!(mut, ["allocator"]), ()),
69 (pred!(mut, ["size", "type", "allocator"]), ()),
70 (pred!(mut, ["size", "type", "s", "allocator"]), ()),
71 (pred!(mut, ["arr", "allocator"]), ()),
72 (pred!(mut, ["rows", "cols", "type", "allocator"]), ()),
73 (pred!(mut, ["rows", "cols", "type", "s", "allocator"]), ()),
74 ],
75 ),
76 ]))
77}
78
79fn dnn_factory() -> FuncUnsafe {
80 FuncMatcher::create(HashMap::from([
81 (
83 "cv::dnn::Dict::ptr",
84 vec![(pred!(const, ["key"]), ()), (pred!(mut, ["key"]), ())],
85 ),
86 ]))
87}