1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::collections::HashSet;

use once_cell::sync::Lazy;

use crate::FuncId;

/// set of functions that should have unsafe in their declaration, element is Func.identifier()
pub static FUNC_UNSAFE: Lazy<HashSet<FuncId>> = Lazy::new(|| {
	HashSet::from([
		// allocates uninitialized memory
		FuncId::new_mut("cv::Mat::Mat", ["size", "type"]),
		FuncId::new_mut("cv::Mat::Mat", ["sizes", "type"]),
		FuncId::new_mut("cv::Mat::Mat", ["ndims", "sizes", "type"]),
		FuncId::new_mut("cv::Mat::Mat", ["rows", "cols", "type"]),
		FuncId::new_mut("cv::Mat::create", ["size", "type"]),
		FuncId::new_mut("cv::Mat::create", ["sizes", "type"]),
		FuncId::new_mut("cv::Mat::create", ["ndims", "sizes", "type"]),
		FuncId::new_mut("cv::Mat::create", ["rows", "cols", "type"]),
		FuncId::new_mut("cv::UMat::UMat", ["size", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::UMat", ["ndims", "sizes", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::UMat", ["rows", "cols", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::create", ["size", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::create", ["size", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::create", ["ndims", "sizes", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::create", ["sizes", "type", "usageFlags"]),
		FuncId::new_mut("cv::UMat::create", ["rows", "cols", "type", "usageFlags"]),
		FuncId::new_const("cv::_OutputArray::createSameSize", ["arr", "mtype"]),
		// pointer to internal data
		FuncId::new_const("cv::dnn::Dict::ptr", ["key"]),
		FuncId::new_mut("cv::dnn::Dict::ptr", ["key"]),
		// takes reference and stores it for the lifetime of an object (fixme: add lifetime management)
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["size", "type", "allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["size", "type", "s", "allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["arr", "allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["rows", "cols", "type", "allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::GpuMat", ["rows", "cols", "type", "s", "allocator"]),
		FuncId::new_mut("cv::cuda::GpuMat::setAllocator", ["val"]),
		FuncId::new_mut("cv::cuda::GpuMat::setDefaultAllocator", ["allocator"]), // fixme, should take 'static
	])
});