extern "C" {
#[doc(hidden)] fn cv_new_VectorOfint() -> *mut c_void;
#[doc(hidden)] fn cv_delete_VectorOfint(ptr: *mut c_void);
#[doc(hidden)] fn cv_push_VectorOfint(ptr: *mut c_void, ptr2: *const c_void);
#[doc(hidden)] fn cv_VectorOfint_len(ptr: *mut c_void) -> i32;
#[doc(hidden)] fn cv_VectorOfint_get(ptr: *mut c_void, index: i32) -> *mut c_void;
}
#[allow(dead_code)]
pub struct VectorOfint {
pub(crate) ptr: *mut c_void
}
impl VectorOfint {
pub fn new() -> Self {
unsafe { Self { ptr: cv_new_VectorOfint() } }
}
pub fn len(&self) -> i32 {
unsafe { cv_VectorOfint_len(self.ptr) }
}
#[doc(hidden)]
pub fn as_raw_VectorOfint(&self) -> *mut c_void {
self.ptr
}
}
impl Drop for VectorOfint {
fn drop(&mut self) {
unsafe { cv_delete_VectorOfint(self.ptr) };
}
}
impl VectorOfint {
pub fn push(&mut self, val: i32) {
unsafe { cv_push_VectorOfint(self.ptr, &val as *const _ as _) }
}
pub fn get(&self, index: i32) -> &mut i32 {
unsafe { (cv_VectorOfint_get(self.ptr, index) as *mut i32).as_mut().unwrap() }
}
}
extern "C" { #[doc(hidden)] fn cv_VectorOfint_data(ptr: *mut c_void) -> *mut c_void; }
impl ::std::ops::Deref for VectorOfint {
type Target = [i32];
fn deref(&self) -> &Self::Target {
unsafe {
let length = cv_VectorOfint_len(self.ptr) as usize;
let data = cv_VectorOfint_data(self.ptr);
::std::slice::from_raw_parts(::std::mem::transmute(data), length)
}
}
}