opencv_binding_generator/settings/
generator_module_tweaks.rs1use super::TypeRefFactory;
2use crate::type_ref::TypeRefDesc;
3use crate::SupportedModule;
4
5#[derive(Debug)]
6pub struct ModuleTweak<'l> {
7 pub generate_types: &'l [TypeRefFactory],
8}
9
10impl ModuleTweak<'_> {
11 pub fn empty() -> Self {
12 Self { generate_types: &[] }
13 }
14}
15
16pub fn generator_module_tweaks_factory(module: SupportedModule) -> ModuleTweak<'static> {
17 match module {
18 SupportedModule::Core => ModuleTweak {
19 generate_types: &[
20 TypeRefDesc::ptr_of_float,
21 TypeRefDesc::ptr_of_cv_keypoint,
23 ],
24 },
25 SupportedModule::Aruco => ModuleTweak {
26 generate_types: &[TypeRefDesc::vector_of_cv_vec3f, TypeRefDesc::vector_of_cv_vec3d],
27 },
28 SupportedModule::CCalib => ModuleTweak {
29 generate_types: &[
30 TypeRefDesc::vector_of_vector_of_cv_vec3f,
32 TypeRefDesc::vector_of_vector_of_cv_vec3d,
33 TypeRefDesc::vector_of_vector_of_cv_point3f,
34 TypeRefDesc::vector_of_vector_of_cv_point3d,
35 TypeRefDesc::vector_of_vector_of_cv_vec2f,
37 TypeRefDesc::vector_of_vector_of_cv_point2f,
38 TypeRefDesc::vector_of_vector_of_cv_vec2d,
39 TypeRefDesc::vector_of_vector_of_cv_point2d,
40 ],
41 },
42 SupportedModule::Calib3d | SupportedModule::Calib | SupportedModule::ThreeD => ModuleTweak {
43 generate_types: &[
44 TypeRefDesc::vector_of_cv_point3i,
46 TypeRefDesc::vector_of_vector_of_cv_point3i,
47 TypeRefDesc::vector_of_cv_point3f,
48 TypeRefDesc::vector_of_vector_of_cv_point3f,
49 TypeRefDesc::vector_of_cv_point3d,
50 TypeRefDesc::vector_of_vector_of_cv_point3d,
51 TypeRefDesc::vector_of_cv_vec3f,
52 TypeRefDesc::vector_of_vector_of_cv_vec3f,
53 TypeRefDesc::vector_of_vector_of_double,
55 TypeRefDesc::vector_of_cv_point2d,
57 ],
58 },
59 SupportedModule::Dnn => ModuleTweak {
60 generate_types: &[TypeRefDesc::vector_of_vector_of_int], },
62 SupportedModule::Features2d | SupportedModule::Features => ModuleTweak {
63 generate_types: &[TypeRefDesc::ptr_of_cv_feature2d],
65 },
66 SupportedModule::ImgProc => ModuleTweak {
67 generate_types: &[
68 TypeRefDesc::vector_of_cv_vec4i,
70 TypeRefDesc::vector_of_vector_of_cv_point,
71 TypeRefDesc::vector_of_cv_vec2f,
73 TypeRefDesc::vector_of_cv_vec2d,
74 TypeRefDesc::vector_of_cv_vec3f,
75 TypeRefDesc::vector_of_cv_vec3d,
76 ],
77 },
78 _ => ModuleTweak::empty(),
79 }
80}