vtk_rs/
vtk_algorithm_output.rs1#[cxx::bridge]
2pub(crate) mod ffi {
3 unsafe extern "C++" {
4 include!("vtk_algorithm_output.h");
5
6 pub type vtkAlgorithm;
7 pub type vtkAlgorithmOutput;
8
9 fn vtk_algorithm_output_new() -> *mut vtkAlgorithmOutput;
10 fn vtk_algorithm_output_delete(algorithm_output: Pin<&mut vtkAlgorithmOutput>);
11
12 fn vtk_algorithm_output_set_index(
13 algorithm_output: Pin<&mut vtkAlgorithmOutput>,
14 index: i64,
15 );
16 fn vtk_algorithm_output_get_index(algorithm_output: &vtkAlgorithmOutput) -> i64;
17 fn vtk_algorithm_output_get_producer(
18 algorithm_output: &vtkAlgorithmOutput,
19 ) -> &vtkAlgorithm;
20 fn vtk_algorithm_output_set_producer(
21 algorithm_output: Pin<&mut vtkAlgorithmOutput>,
22 producer: &vtkAlgorithm,
23 );
24 }
25}
26
27crate::define_object!(
28 "https://vtk.org/doc/nightly/html/classvtkAlgorithmOutput.html",
29 @name AlgorithmOutput, ffi::vtkAlgorithmOutput,
30 @new ffi::vtk_algorithm_output_new,
31 @delete ffi::vtk_algorithm_output_delete,
32 @inherit vtkAlgorithmOutput
33);
34
35pub(crate) mod private {
36 pub trait Sealed {}
37}
38
39#[allow(non_camel_case_types)]
41pub trait vtkAlgorithmOutput: private::Sealed {
42 #[doc(hidden)]
43 fn as_vtk_algorithm_output(&self) -> core::pin::Pin<&ffi::vtkAlgorithmOutput>;
44 #[doc(hidden)]
45 fn as_vtk_algorithm_output_mut(&mut self) -> core::pin::Pin<&mut ffi::vtkAlgorithmOutput>;
46
47 #[doc(alias = "SetIndex")]
48 fn set_index(&mut self, index: i64) {
49 ffi::vtk_algorithm_output_set_index(self.as_vtk_algorithm_output_mut(), index);
50 }
51
52 #[doc(alias = "GetIndex")]
53 fn get_index(&self) -> i64 {
54 ffi::vtk_algorithm_output_get_index(&self.as_vtk_algorithm_output())
55 }
56
57 #[doc(alias = "GetProducer")]
58 fn get_producer(&self) -> Option<&crate::Algorithm> {
59 let sself = self.as_vtk_algorithm_output();
60 let x = ffi::vtk_algorithm_output_get_producer(&sself);
61 let y = x as *const _ as *const crate::vtk_algorithm::Algorithm;
62 unsafe { y.as_ref() }
63 }
64
65 #[doc(alias = "SetProducer")]
66 fn set_producer(&mut self, producer: &impl crate::vtkAlgorithm) {
67 let producer = &producer.as_vtk_algorithm() as *const _ as *const ffi::vtkAlgorithm;
68 let sself = self.as_vtk_algorithm_output_mut();
69 ffi::vtk_algorithm_output_set_producer(sself, unsafe { &*producer });
70 }
71}