vtk_rs/
vtkCommonSystem.rs

1/// Encapsulates a client socket.
2///
3#[allow(non_camel_case_types)]
4pub struct vtkClientSocket(*mut core::ffi::c_void);
5impl vtkClientSocket {
6    /// Creates a new [vtkClientSocket] wrapped inside `vtkNew`
7    #[doc(alias = "vtkClientSocket")]
8    pub fn new() -> Self {
9        unsafe extern "C" {
10            fn vtkClientSocket_new() -> *mut core::ffi::c_void;
11        }
12        Self(unsafe { &mut *vtkClientSocket_new() })
13    }
14    #[cfg(test)]
15    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
16        unsafe extern "C" {
17            fn vtkClientSocket_get_ptr(
18                sself: *mut core::ffi::c_void,
19            ) -> *mut core::ffi::c_void;
20        }
21        unsafe { vtkClientSocket_get_ptr(self.0) }
22    }
23}
24impl std::default::Default for vtkClientSocket {
25    fn default() -> Self {
26        Self::new()
27    }
28}
29impl Drop for vtkClientSocket {
30    fn drop(&mut self) {
31        unsafe extern "C" {
32            fn vtkClientSocket_destructor(sself: *mut core::ffi::c_void);
33        }
34        unsafe { vtkClientSocket_destructor(self.0) }
35        self.0 = core::ptr::null_mut();
36    }
37}
38#[test]
39fn test_vtkClientSocket_create_drop() {
40    let obj = vtkClientSocket::new();
41    let ptr = obj.0;
42    assert!(!ptr.is_null());
43    assert!(unsafe { !obj._get_ptr().is_null() });
44    drop(obj);
45    let new_obj = vtkClientSocket(ptr);
46    assert!(unsafe { new_obj._get_ptr().is_null() });
47}
48/// OS independent class for access and manipulation of system directories
49///
50///
51/// vtkDirectory provides a portable way of finding the names of the files
52/// in a system directory.  It also provides methods of manipulating directories.
53///
54/// @warning
55/// vtkDirectory works with windows and unix only.
56#[allow(non_camel_case_types)]
57pub struct vtkDirectory(*mut core::ffi::c_void);
58impl vtkDirectory {
59    /// Creates a new [vtkDirectory] wrapped inside `vtkNew`
60    #[doc(alias = "vtkDirectory")]
61    pub fn new() -> Self {
62        unsafe extern "C" {
63            fn vtkDirectory_new() -> *mut core::ffi::c_void;
64        }
65        Self(unsafe { &mut *vtkDirectory_new() })
66    }
67    #[cfg(test)]
68    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
69        unsafe extern "C" {
70            fn vtkDirectory_get_ptr(
71                sself: *mut core::ffi::c_void,
72            ) -> *mut core::ffi::c_void;
73        }
74        unsafe { vtkDirectory_get_ptr(self.0) }
75    }
76}
77impl std::default::Default for vtkDirectory {
78    fn default() -> Self {
79        Self::new()
80    }
81}
82impl Drop for vtkDirectory {
83    fn drop(&mut self) {
84        unsafe extern "C" {
85            fn vtkDirectory_destructor(sself: *mut core::ffi::c_void);
86        }
87        unsafe { vtkDirectory_destructor(self.0) }
88        self.0 = core::ptr::null_mut();
89    }
90}
91#[test]
92fn test_vtkDirectory_create_drop() {
93    let obj = vtkDirectory::new();
94    let ptr = obj.0;
95    assert!(!ptr.is_null());
96    assert!(unsafe { !obj._get_ptr().is_null() });
97    drop(obj);
98    let new_obj = vtkDirectory(ptr);
99    assert!(unsafe { new_obj._get_ptr().is_null() });
100}
101/// Launch a process on the current machine and get its output
102///
103///
104/// Launch a process on the current machine and get its standard output and
105/// standard error output. When `ExecuteInSystemShell` is false, arguments
106/// needs to be added separately using the `AddArgument` / `ClearArguments`
107/// API, otherwise command may not work correctly. If one does not know how to
108/// parse the arguments of the command it want to execute then
109/// `ExecuteInSystemShell` should be set to true.
110#[allow(non_camel_case_types)]
111pub struct vtkExecutableRunner(*mut core::ffi::c_void);
112impl vtkExecutableRunner {
113    /// Creates a new [vtkExecutableRunner] wrapped inside `vtkNew`
114    #[doc(alias = "vtkExecutableRunner")]
115    pub fn new() -> Self {
116        unsafe extern "C" {
117            fn vtkExecutableRunner_new() -> *mut core::ffi::c_void;
118        }
119        Self(unsafe { &mut *vtkExecutableRunner_new() })
120    }
121    #[cfg(test)]
122    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
123        unsafe extern "C" {
124            fn vtkExecutableRunner_get_ptr(
125                sself: *mut core::ffi::c_void,
126            ) -> *mut core::ffi::c_void;
127        }
128        unsafe { vtkExecutableRunner_get_ptr(self.0) }
129    }
130}
131impl std::default::Default for vtkExecutableRunner {
132    fn default() -> Self {
133        Self::new()
134    }
135}
136impl Drop for vtkExecutableRunner {
137    fn drop(&mut self) {
138        unsafe extern "C" {
139            fn vtkExecutableRunner_destructor(sself: *mut core::ffi::c_void);
140        }
141        unsafe { vtkExecutableRunner_destructor(self.0) }
142        self.0 = core::ptr::null_mut();
143    }
144}
145#[test]
146fn test_vtkExecutableRunner_create_drop() {
147    let obj = vtkExecutableRunner::new();
148    let ptr = obj.0;
149    assert!(!ptr.is_null());
150    assert!(unsafe { !obj._get_ptr().is_null() });
151    drop(obj);
152    let new_obj = vtkExecutableRunner(ptr);
153    assert!(unsafe { new_obj._get_ptr().is_null() });
154}
155/// Encapsulate a socket that accepts connections.
156///
157#[allow(non_camel_case_types)]
158pub struct vtkServerSocket(*mut core::ffi::c_void);
159impl vtkServerSocket {
160    /// Creates a new [vtkServerSocket] wrapped inside `vtkNew`
161    #[doc(alias = "vtkServerSocket")]
162    pub fn new() -> Self {
163        unsafe extern "C" {
164            fn vtkServerSocket_new() -> *mut core::ffi::c_void;
165        }
166        Self(unsafe { &mut *vtkServerSocket_new() })
167    }
168    #[cfg(test)]
169    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
170        unsafe extern "C" {
171            fn vtkServerSocket_get_ptr(
172                sself: *mut core::ffi::c_void,
173            ) -> *mut core::ffi::c_void;
174        }
175        unsafe { vtkServerSocket_get_ptr(self.0) }
176    }
177}
178impl std::default::Default for vtkServerSocket {
179    fn default() -> Self {
180        Self::new()
181    }
182}
183impl Drop for vtkServerSocket {
184    fn drop(&mut self) {
185        unsafe extern "C" {
186            fn vtkServerSocket_destructor(sself: *mut core::ffi::c_void);
187        }
188        unsafe { vtkServerSocket_destructor(self.0) }
189        self.0 = core::ptr::null_mut();
190    }
191}
192#[test]
193fn test_vtkServerSocket_create_drop() {
194    let obj = vtkServerSocket::new();
195    let ptr = obj.0;
196    assert!(!ptr.is_null());
197    assert!(unsafe { !obj._get_ptr().is_null() });
198    drop(obj);
199    let new_obj = vtkServerSocket(ptr);
200    assert!(unsafe { new_obj._get_ptr().is_null() });
201}
202/// a collection for sockets.
203///
204///
205/// Apart from being vtkCollection subclass for sockets, this class
206/// provides means to wait for activity on all the sockets in the
207/// collection simultaneously.
208#[allow(non_camel_case_types)]
209pub struct vtkSocketCollection(*mut core::ffi::c_void);
210impl vtkSocketCollection {
211    /// Creates a new [vtkSocketCollection] wrapped inside `vtkNew`
212    #[doc(alias = "vtkSocketCollection")]
213    pub fn new() -> Self {
214        unsafe extern "C" {
215            fn vtkSocketCollection_new() -> *mut core::ffi::c_void;
216        }
217        Self(unsafe { &mut *vtkSocketCollection_new() })
218    }
219    #[cfg(test)]
220    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
221        unsafe extern "C" {
222            fn vtkSocketCollection_get_ptr(
223                sself: *mut core::ffi::c_void,
224            ) -> *mut core::ffi::c_void;
225        }
226        unsafe { vtkSocketCollection_get_ptr(self.0) }
227    }
228}
229impl std::default::Default for vtkSocketCollection {
230    fn default() -> Self {
231        Self::new()
232    }
233}
234impl Drop for vtkSocketCollection {
235    fn drop(&mut self) {
236        unsafe extern "C" {
237            fn vtkSocketCollection_destructor(sself: *mut core::ffi::c_void);
238        }
239        unsafe { vtkSocketCollection_destructor(self.0) }
240        self.0 = core::ptr::null_mut();
241    }
242}
243#[test]
244fn test_vtkSocketCollection_create_drop() {
245    let obj = vtkSocketCollection::new();
246    let ptr = obj.0;
247    assert!(!ptr.is_null());
248    assert!(unsafe { !obj._get_ptr().is_null() });
249    drop(obj);
250    let new_obj = vtkSocketCollection(ptr);
251    assert!(unsafe { new_obj._get_ptr().is_null() });
252}
253/// Timer support and logging
254///
255///
256/// vtkTimerLog contains walltime and cputime measurements associated
257/// with a given event.  These results can be later analyzed when
258/// "dumping out" the table.
259///
260/// In addition, vtkTimerLog allows the user to simply get the current
261/// time, and to start/stop a simple timer separate from the timing
262/// table logging.
263#[allow(non_camel_case_types)]
264pub struct vtkTimerLog(*mut core::ffi::c_void);
265impl vtkTimerLog {
266    /// Creates a new [vtkTimerLog] wrapped inside `vtkNew`
267    #[doc(alias = "vtkTimerLog")]
268    pub fn new() -> Self {
269        unsafe extern "C" {
270            fn vtkTimerLog_new() -> *mut core::ffi::c_void;
271        }
272        Self(unsafe { &mut *vtkTimerLog_new() })
273    }
274    #[cfg(test)]
275    unsafe fn _get_ptr(&self) -> *mut core::ffi::c_void {
276        unsafe extern "C" {
277            fn vtkTimerLog_get_ptr(
278                sself: *mut core::ffi::c_void,
279            ) -> *mut core::ffi::c_void;
280        }
281        unsafe { vtkTimerLog_get_ptr(self.0) }
282    }
283}
284impl std::default::Default for vtkTimerLog {
285    fn default() -> Self {
286        Self::new()
287    }
288}
289impl Drop for vtkTimerLog {
290    fn drop(&mut self) {
291        unsafe extern "C" {
292            fn vtkTimerLog_destructor(sself: *mut core::ffi::c_void);
293        }
294        unsafe { vtkTimerLog_destructor(self.0) }
295        self.0 = core::ptr::null_mut();
296    }
297}
298#[test]
299fn test_vtkTimerLog_create_drop() {
300    let obj = vtkTimerLog::new();
301    let ptr = obj.0;
302    assert!(!ptr.is_null());
303    assert!(unsafe { !obj._get_ptr().is_null() });
304    drop(obj);
305    let new_obj = vtkTimerLog(ptr);
306    assert!(unsafe { new_obj._get_ptr().is_null() });
307}