use super::TypeRefFactory;
use crate::type_ref::TypeRefDesc;
use crate::SupportedModule;
#[derive(Debug)]
pub struct ModuleTweak<'l> {
pub generate_types: &'l [TypeRefFactory],
}
impl ModuleTweak<'_> {
pub fn empty() -> Self {
Self { generate_types: &[] }
}
}
pub fn generator_module_tweaks_factory(module: SupportedModule) -> ModuleTweak<'static> {
match module {
SupportedModule::Core => ModuleTweak {
generate_types: &[
TypeRefDesc::ptr_of_float,
TypeRefDesc::ptr_of_cv_keypoint,
],
},
SupportedModule::Aruco => ModuleTweak {
generate_types: &[TypeRefDesc::vector_of_cv_vec3f, TypeRefDesc::vector_of_cv_vec3d],
},
SupportedModule::CCalib => ModuleTweak {
generate_types: &[
TypeRefDesc::vector_of_vector_of_cv_vec3f,
TypeRefDesc::vector_of_vector_of_cv_vec3d,
TypeRefDesc::vector_of_vector_of_cv_point3f,
TypeRefDesc::vector_of_vector_of_cv_point3d,
TypeRefDesc::vector_of_vector_of_cv_vec2f,
TypeRefDesc::vector_of_vector_of_cv_point2f,
TypeRefDesc::vector_of_vector_of_cv_vec2d,
TypeRefDesc::vector_of_vector_of_cv_point2d,
],
},
SupportedModule::Calib3d | SupportedModule::Calib | SupportedModule::ThreeD => ModuleTweak {
generate_types: &[
TypeRefDesc::vector_of_cv_point3i,
TypeRefDesc::vector_of_vector_of_cv_point3i,
TypeRefDesc::vector_of_cv_point3f,
TypeRefDesc::vector_of_vector_of_cv_point3f,
TypeRefDesc::vector_of_cv_point3d,
TypeRefDesc::vector_of_vector_of_cv_point3d,
TypeRefDesc::vector_of_cv_vec3f,
TypeRefDesc::vector_of_vector_of_cv_vec3f,
TypeRefDesc::vector_of_vector_of_double,
TypeRefDesc::vector_of_cv_point2d,
],
},
SupportedModule::Dnn => ModuleTweak {
generate_types: &[TypeRefDesc::vector_of_vector_of_int], },
SupportedModule::Features2d | SupportedModule::Features => ModuleTweak {
generate_types: &[TypeRefDesc::ptr_of_cv_feature2d],
},
SupportedModule::ImgProc => ModuleTweak {
generate_types: &[
TypeRefDesc::vector_of_cv_vec4i,
TypeRefDesc::vector_of_vector_of_cv_point,
TypeRefDesc::vector_of_cv_vec2f,
TypeRefDesc::vector_of_cv_vec2d,
TypeRefDesc::vector_of_cv_vec3f,
TypeRefDesc::vector_of_cv_vec3d,
],
},
_ => ModuleTweak::empty(),
}
}