cobia/cape_data_from_provider.rs
1use crate::*;
2
3/// CapeStringInFromProvider
4///
5/// When calling a CAPE-OPEN method that takes a CapeString as input,
6/// the caller provides an object that implements `CapeStringProviderIn`,
7/// for example `CapeStringImpl`.
8///
9/// The CapeStringInFromProvider returns an `C::ICapeString` interface, which
10/// has a small life span, enough to make sure that the pointer to this
11/// interface is valid. This is done inside wrapper classes such as
12/// `capeopen_1_2::CapeIdentification`,
13///
14/// When implementing a function that gets called, and takes a CapeString
15/// as input, it received a `&CapeStringIn` typed argument, which is
16/// constructed from the reference to an `C::ICapeString` interface pointer.
17///
18/// Typically a function call receives the `C::ICapeString` interface
19/// from the caller, and from this, the `CapeStringIn` is constructed by
20/// the `cape_object_implementation` macro.
21///
22/// In the rare case that one wants to call an internal CAPE-OPEN function
23/// directly, one needs to provide the class that implements the
24/// `CapeStringProviderIn` trait, allocate the pointer, point to it, and
25/// construct the `CapeStringIn` object from a reference to that pointer.
26///
27/// The `CapeStringInFromProvider` class does all this.
28///
29/// # Example
30/// ```
31/// use cobia::*;
32/// let string = CapeStringImpl::from_string("Hello");
33/// fn StringFromCapeStringIn(string:&CapeStringIn) -> String {
34/// string.as_string()
35/// }
36/// let value=StringFromCapeStringIn(&CapeStringInFromProvider::from(&string).as_cape_string_in()); //this is how string is passed as &CapeStringIn argument
37/// assert_eq!(value,"Hello".to_string());
38/// ```
39
40pub struct CapeStringInFromProvider {
41 interface: C::ICapeString,
42 interface_ptr: *mut C::ICapeString,
43}
44
45impl CapeStringInFromProvider {
46
47 pub fn from<T:CapeStringProviderIn>(provider:&T) -> Self {
48 Self {
49 interface: provider.as_cape_string_in(),
50 interface_ptr: std::ptr::null_mut(),
51 }
52 }
53
54 pub fn as_cape_string_in(&mut self) -> CapeStringIn<'_> {
55 self.interface_ptr=&mut self.interface as *mut C::ICapeString;
56 CapeStringIn::new(& self.interface_ptr)
57 }
58
59}
60
61/// CapeStringOutFromProvider
62///
63/// When calling a CAPE-OPEN method that takes a CapeString as output,
64/// the caller provides an object that implements `CapeStringProviderOut`,
65/// for example `CapeStringImpl`.
66///
67/// The `CapeStringOutFromProvider` returns an `C::ICapeString` interface, which
68/// has a small life span, enough to make sure that the pointer to this
69/// interface is valid. This is done inside wrapper classes such as
70/// `capeopen_1_2::CapeIdentification`,
71///
72/// When implementing a function that gets called, and takes a CapeString
73/// as output, it received a `&mut CapeStringOut` typed argument, which is
74/// constructed from the reference to an `C::ICapeString` interface pointer.
75///
76/// Typically a function call receives the C::ICapeString interface
77/// from the caller, and from this, the `CapeStringOut` is constructed by
78/// the `cape_object_implementation` macro.
79///
80/// In the rare case that one wants to call an internal CAPE-OPEN function
81/// directly, one needs to provide the class that implements the
82/// `CapeStringProviderOut` trait, allocate the pointer, point to it, and
83/// construct the `CapeStringOut` object from a reference to that pointer.
84///
85/// The `CapeStringOutFromProvider` class does all this.
86///
87/// # Example
88/// ```
89/// use cobia::*;
90/// let mut string = CapeStringImpl::new();
91/// fn SetCapeStringOut(string:&CapeStringOut) {
92/// string.set_string("Hello");
93/// }
94/// SetCapeStringOut(&mut CapeStringOutFromProvider::from(&mut string).as_cape_string_out()); //this is how string is passed as &mut CapeStringOut argument
95/// assert_eq!(string.as_string(),"Hello".to_string());
96/// ```
97
98pub struct CapeStringOutFromProvider {
99 interface: C::ICapeString,
100 interface_ptr: *mut C::ICapeString,
101}
102
103impl CapeStringOutFromProvider {
104
105 pub fn from<T:CapeStringProviderOut>(provider:&mut T) -> Self {
106 Self {
107 interface: provider.as_cape_string_out(),
108 interface_ptr: std::ptr::null_mut(),
109 }
110 }
111
112 pub fn as_cape_string_out(&mut self) -> CapeStringOut<'_> {
113 self.interface_ptr=&mut self.interface as *mut C::ICapeString;
114 CapeStringOut::new(& mut self.interface_ptr)
115 }
116
117}
118
119/// CapeValueInFromProvider
120///
121/// When calling a CAPE-OPEN method that takes a CapeValue as input,
122/// the caller provides an object that implements `CapeValueProviderIn`,
123/// for example `CapeValueImpl`.
124///
125/// The `CapeValueInFromProvider` returns an `C::ICapeValue` interface, which
126/// has a small life span, enough to make sure that the pointer to this
127/// interface is valid. This is done inside wrapper classes such as
128/// `capeopen_1_2::CapePersistWriter`.
129///
130/// When implementing a function that gets called, and takes a CapeValue
131/// as input, it received a `&CapeValueIn` typed argument, which is
132/// constructed from the reference to an `C::ICapeValue` interface pointer.
133///
134/// Typically a function call receives the `C::ICapeValue` interface
135/// from the caller, and from this, the `CapeValueIn` is constructed by
136/// the `cape_object_implementation` macro.
137///
138/// In the rare case that one wants to call an internal CAPE-OPEN function
139/// directly, one needs to provide the class that implements the
140/// `CapeValueProviderIn` trait, allocate the pointer, point to it, and
141/// construct the `CapeValueIn` object from a reference to that pointer.
142///
143/// The `CapeValueInFromProvider` class does all this.
144///
145/// # Example
146/// ```
147/// use cobia::*;
148/// let value = CapeValueImpl::from_real(3.14);
149/// fn ValueFromCapeValueIn(value:&CapeValueIn) -> f64 {
150/// assert!(value.get_type().unwrap()==cobia::CapeValueType::Real);
151/// value.get_real().unwrap()
152/// }
153/// let value=ValueFromCapeValueIn(&CapeValueInFromProvider::from(&value).as_cape_value_in()); //this is how value is passed as &CapeValueIn argument
154/// assert_eq!(value,3.14);
155/// ```
156
157pub struct CapeValueInFromProvider {
158 interface: C::ICapeValue,
159 interface_ptr: *mut C::ICapeValue,
160}
161
162impl CapeValueInFromProvider {
163 pub fn from<T:CapeValueProviderIn>(provider:&T) -> Self {
164 Self {
165 interface: provider.as_cape_value_in(),
166 interface_ptr: std::ptr::null_mut(),
167 }
168 }
169 pub fn as_cape_value_in(&mut self) -> CapeValueIn<'_> {
170 self.interface_ptr=&mut self.interface as *mut C::ICapeValue;
171 CapeValueIn::new(& self.interface_ptr)
172 }
173}
174
175/// CapeValueOutFromProvider
176///
177/// When calling a CAPE-OPEN method that takes a CapeValue as output,
178/// the caller provides an object that implements `CapeValueProviderOut`,
179/// for example `CapeValueImpl`.
180///
181/// The `CapeValueOutFromProvider` returns an `C::ICapeValue` interface, which
182/// has a small life span, enough to make sure that the pointer to this
183/// interface is valid. This is done inside wrapper classes such as
184/// `capeopen_1_2::CapeCOSEUtilities`.
185///
186/// When implementing a function that gets called, and takes a CapeValue
187/// as output, it received a `&mut CapeValueOut` typed argument, which is
188/// constructed from the reference to an `C::ICapeValue` interface pointer.
189///
190/// Typically a function call receives the `C::ICapeValue` interface
191/// from the caller, and from this, the `CapeValueOut` is constructed by
192/// the `cape_object_implementation` macro.
193///
194/// In the rare case that one wants to call an internal CAPE-OPEN function
195/// directly, one needs to provide the class that implements the
196/// `CapeValueProviderOut` trait, allocate the pointer, point to it, and
197/// construct the `CapeValueOut` object from a reference to that pointer.
198///
199/// The `CapeValueOutFromProvider` class does all this.
200///
201/// # Example
202/// ```
203/// use cobia::*;
204/// let mut value = CapeValueImpl::new();
205/// fn SetValueOut(value:&CapeValueOut) {
206/// value.set_integer(8);
207/// }
208/// SetValueOut(&mut CapeValueOutFromProvider::from(&mut value).as_cape_value_out()); //this is how value is passed as &mut CapeValueOut argument
209/// assert_eq!(value.value(),CapeValueContent::Integer(8));
210/// ```
211
212pub struct CapeValueOutFromProvider {
213 interface: C::ICapeValue,
214 interface_ptr: *mut C::ICapeValue,
215}
216
217impl CapeValueOutFromProvider {
218 pub fn from<T:CapeValueProviderOut>(provider:&mut T) -> Self {
219 Self {
220 interface: provider.as_cape_value_out(),
221 interface_ptr: std::ptr::null_mut(),
222 }
223 }
224 pub fn as_cape_value_out(&mut self) -> CapeValueOut<'_> {
225 self.interface_ptr=&mut self.interface as *mut C::ICapeValue;
226 CapeValueOut::new(& mut self.interface_ptr)
227 }
228}
229
230/// CapeArrayStringInFromProvider
231///
232/// When calling a CAPE-OPEN method that takes a CapeArrayString as input,
233/// the caller provides an object that implements `CapeArrayStringProviderIn`,
234/// for example `CapeArrayStringVec`.
235///
236/// The `CapeArrayStringInFromProvider` returns an `C::ICapeArrayString` interface, which
237/// has a small life span, enough to make sure that the pointer to this
238/// interface is valid. This is done inside wrapper classes such as
239/// `capeopen_1_2::CapeThermoMaterial`.
240///
241/// When implementing a function that gets called, and takes a CapeArrayString
242/// as input, it received a `&CapeArrayStringIn` typed argument, which is
243/// constructed from the reference to an `C::ICapeArrayString` interface pointer.
244///
245/// Typically a function call receives the `C::ICapeArrayString` interface
246/// from the caller, and from this, the `CapeArrayStringIn` is constructed by
247/// the `cape_object_implementation` macro.
248///
249/// In the rare case that one wants to call an internal CAPE-OPEN function
250/// directly, one needs to provide the class that implements the
251/// `CapeArrayStringProviderIn` trait, allocate the pointer, point to it, and
252/// construct the `CapeArrayStringIn` object from a reference to that pointer.
253///
254/// The `CapeArrayStringInFromProvider` class does all this.
255///
256/// # Example
257/// ```
258/// use cobia::*;
259/// let array = CapeArrayStringVec::from_slice(&["Hello","World"]);
260/// fn ArrayFromCapeArrayStringIn(array:&CapeArrayStringIn) -> Vec<String> {
261/// array.as_string_vec()
262/// }
263/// let value=ArrayFromCapeArrayStringIn(&CapeArrayStringInFromProvider::from(&array).as_cape_array_string_in()); //this is how array is passed as &CapeArrayStringIn argument
264/// assert_eq!(value,vec!["Hello".to_string(),"World".to_string()]);
265/// ```
266
267pub struct CapeArrayStringInFromProvider {
268 interface: C::ICapeArrayString,
269 interface_ptr: *mut C::ICapeArrayString,
270}
271
272impl CapeArrayStringInFromProvider {
273 pub fn from<T:CapeArrayStringProviderIn>(provider:&T) -> Self {
274 Self {
275 interface: provider.as_cape_array_string_in(),
276 interface_ptr: std::ptr::null_mut(),
277 }
278 }
279 pub fn as_cape_array_string_in(&mut self) -> CapeArrayStringIn<'_> {
280 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayString;
281 CapeArrayStringIn::new(& self.interface_ptr)
282 }
283}
284
285/// CapeArrayStringOutFromProvider
286///
287/// When calling a CAPE-OPEN method that takes a CapeArrayString as output,
288/// the caller provides an object that implements `CapeArrayStringProviderOut`,
289/// for example `CapeArrayStringVec`.
290///
291/// The `CapeArrayStringOutFromProvider` returns an `C::ICapeArrayString` interface, which
292/// has a small life span, enough to make sure that the pointer to this
293/// interface is valid. This is done inside wrapper classes such as
294/// `capeopen_1_2::CapeThermoMaterial`.
295///
296/// When implementing a function that gets called, and takes a CapeArrayString
297/// as output, it received a `&mut CapeArrayStringOut` typed argument, which is
298/// constructed from the reference to an `C::ICapeArrayString` interface pointer.
299///
300/// Typically a function call receives the `C::ICapeArrayString` interface
301/// from the caller, and from this, the `CapeArrayStringOut` is constructed by
302/// the `cape_object_implementation` macro.
303///
304/// In the rare case that one wants to call an internal CAPE-OPEN function
305/// directly, one needs to provide the class that implements the
306/// `CapeArrayStringProviderOut` trait, allocate the pointer, point to it, and
307/// construct the `CapeArrayStringOut` object from a reference to that pointer.
308///
309/// The `CapeArrayStringOutFromProvider` class does all this.
310///
311/// # Example
312/// ```
313/// use cobia::*;
314/// let mut array = CapeArrayStringVec::new();
315/// fn SetArrayOut(array:&mut CapeArrayStringOut) {
316/// array.put_array(&["Hello","World"]);
317/// }
318/// SetArrayOut(&mut CapeArrayStringOutFromProvider::from(&mut array).as_cape_array_string_out()); //this is how array is passed as &mut CapeArrayStringOut argument
319/// assert_eq!(array.as_string_vec(),vec!["Hello".to_string(),"World".to_string()]);
320/// ```
321
322pub struct CapeArrayStringOutFromProvider {
323 interface: C::ICapeArrayString,
324 interface_ptr: *mut C::ICapeArrayString,
325}
326
327impl CapeArrayStringOutFromProvider {
328 pub fn from<T:CapeArrayStringProviderOut>(provider:&mut T) -> Self {
329 Self {
330 interface: provider.as_cape_array_string_out(),
331 interface_ptr: std::ptr::null_mut(),
332 }
333 }
334 pub fn as_cape_array_string_out(&mut self) -> CapeArrayStringOut<'_> {
335 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayString;
336 CapeArrayStringOut::new(& mut self.interface_ptr)
337 }
338}
339
340/// CapeArrayIntegerInFromProvider
341///
342/// When calling a CAPE-OPEN method that takes a CapeArrayInteger as input,
343/// the caller provides an object that implements `CapeArrayIntegerProviderIn`,
344/// for example `CapeArrayIntegerVec`.
345///
346/// The `CapeArrayIntegerInFromProvider` returns an `C::ICapeArrayInteger` interface, which
347/// has a small life span, enough to make sure that the pointer to this
348/// interface is valid. This is done inside wrapper classes such as
349/// `capeopen_1_2::CapeArrayRealParameter`.
350///
351/// When implementing a function that gets called, and takes a CapeArrayInteger
352/// as input, it received a `&CapeArrayIntegerIn` typed argument, which is
353/// constructed from the reference to an `C::ICapeArrayInteger` interface pointer.
354///
355/// Typically a function call receives the `C::ICapeArrayInteger` interface
356/// from the caller, and from this, the `CapeArrayIntegerIn` is constructed by
357/// the `cape_object_implementation` macro.
358///
359/// In the rare case that one wants to call an internal CAPE-OPEN function
360/// directly, one needs to provide the class that implements the
361/// `CapeArrayIntegerProviderIn` trait, allocate the pointer, point to it, and
362/// construct the `CapeArrayIntegerIn` object from a reference to that pointer.
363///
364/// The `CapeArrayIntegerInFromProvider` class does all this.
365///
366/// # Example
367/// ```
368/// use cobia::*;
369/// let array = CapeArrayIntegerVec::from_slice(&[1,2,3]);
370/// fn ArrayFromCapeArrayIntegerIn(array:&CapeArrayIntegerIn) -> Vec<i32> {
371/// array.as_vec()
372/// }
373/// let value=ArrayFromCapeArrayIntegerIn(&CapeArrayIntegerInFromProvider::from(&array).as_cape_array_integer_in()); //this is how array is passed as &CapeArrayIntegerIn argument
374/// assert_eq!(value,vec![1,2,3]);
375/// ```
376
377pub struct CapeArrayIntegerInFromProvider {
378 interface: C::ICapeArrayInteger,
379 interface_ptr: *mut C::ICapeArrayInteger,
380}
381
382impl CapeArrayIntegerInFromProvider {
383 pub fn from<T:CapeArrayIntegerProviderIn>(provider:&T) -> Self {
384 Self {
385 interface: provider.as_cape_array_integer_in(),
386 interface_ptr: std::ptr::null_mut(),
387 }
388 }
389 pub fn as_cape_array_integer_in(&mut self) -> CapeArrayIntegerIn<'_> {
390 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayInteger;
391 CapeArrayIntegerIn::new(& self.interface_ptr)
392 }
393}
394
395/// CapeArrayIntegerOutFromProvider
396///
397/// When calling a CAPE-OPEN method that takes a CapeArrayInteger as output,
398/// the caller provides an object that implements `CapeArrayIntegerProviderOut`,
399/// for example `CapeArrayIntegerVec`.
400///
401/// The `CapeArrayIntegerOutFromProvider` returns an `C::ICapeArrayInteger` interface, which
402/// has a small life span, enough to make sure that the pointer to this
403/// interface is valid. This is done inside wrapper classes such as
404/// `capeopen_1_2::CapeArrayIntegerParameter`.
405///
406/// When implementing a function that gets called, and takes a CapeArrayInteger
407/// as output, it received a `&mut CapeArrayIntegerOut` typed argument, which is
408/// constructed from the reference to an `C::ICapeArrayInteger` interface pointer.
409///
410/// Typically a function call receives the `C::ICapeArrayInteger` interface
411/// from the caller, and from this, the `CapeArrayIntegerOut` is constructed by
412/// the `cape_object_implementation` macro.
413///
414/// In the rare case that one wants to call an internal CAPE-OPEN function
415/// directly, one needs to provide the class that implements the
416/// `CapeArrayIntegerProviderOut` trait, allocate the pointer, point to it, and
417/// construct the `CapeArrayIntegerOut` object from a reference to that pointer.
418///
419/// The `CapeArrayIntegerOutFromProvider` class does all this.
420///
421/// # Example
422/// ```
423/// use cobia::*;
424/// let mut array = CapeArrayIntegerVec::new();
425/// fn SetArrayOut(array:&mut CapeArrayIntegerOut) {
426/// array.put_array(&[1,2,3]);
427/// }
428/// SetArrayOut(&mut CapeArrayIntegerOutFromProvider::from(&mut array).as_cape_array_integer_out()); //this is how array is passed as &mut CapeArrayIntegerOut argument
429/// assert_eq!(array.as_vec(),&vec![1,2,3]);
430/// ```
431
432pub struct CapeArrayIntegerOutFromProvider {
433 interface: C::ICapeArrayInteger,
434 interface_ptr: *mut C::ICapeArrayInteger,
435}
436
437impl CapeArrayIntegerOutFromProvider {
438 pub fn from<T:CapeArrayIntegerProviderOut>(provider:&mut T) -> Self {
439 Self {
440 interface: provider.as_cape_array_integer_out(),
441 interface_ptr: std::ptr::null_mut(),
442 }
443 }
444 pub fn as_cape_array_integer_out(&mut self) -> CapeArrayIntegerOut<'_> {
445 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayInteger;
446 CapeArrayIntegerOut::new(& mut self.interface_ptr)
447 }
448}
449
450/// CapeArrayRealInFromProvider
451///
452/// When calling a CAPE-OPEN method that takes a CapeArrayReal as input,
453/// the caller provides an object that implements `CapeArrayRealProviderIn`,
454/// for example `CapeArrayRealVec`.
455///
456/// The `CapeArrayRealInFromProvider` returns an `C::ICapeArrayReal` interface, which
457/// has a small life span, enough to make sure that the pointer to this
458/// interface is valid. This is done inside wrapper classes such as
459/// `capeopen_1_2::CapeThermoMaterial`.
460///
461/// When implementing a function that gets called, and takes a CapeArrayReal
462/// as input, it received a `&CapeArrayRealIn` typed argument, which is
463/// constructed from the reference to an `C::ICapeArrayReal` interface pointer.
464///
465/// Typically a function call receives the `C::ICapeArrayReal` interface
466/// from the caller, and from this, the `CapeArrayRealIn` is constructed by
467/// the `cape_object_implementation` macro.
468///
469/// In the rare case that one wants to call an internal CAPE-OPEN function
470/// directly, one needs to provide the class that implements the
471/// `CapeArrayRealProviderIn` trait, allocate the pointer, point to it, and
472/// construct the `CapeArrayRealIn` object from a reference to that pointer.
473///
474/// The `CapeArrayRealInFromProvider` class does all this.
475///
476/// # Example
477/// ```
478/// use cobia::*;
479/// let array = CapeArrayRealVec::from_slice(&[1.0,2.0,3.0]);
480/// fn ArrayFromCapeArrayRealIn(array:&CapeArrayRealIn) -> Vec<f64> {
481/// array.as_vec()
482/// }
483/// let value=ArrayFromCapeArrayRealIn(&CapeArrayRealInFromProvider::from(&array).as_cape_array_real_in()); //this is how array is passed as &CapeArrayRealIn argument
484/// assert_eq!(value,vec![1.0,2.0,3.0]);
485/// ```
486
487pub struct CapeArrayRealInFromProvider {
488 interface: C::ICapeArrayReal,
489 interface_ptr: *mut C::ICapeArrayReal,
490}
491
492impl CapeArrayRealInFromProvider {
493 pub fn from<T:CapeArrayRealProviderIn>(provider:&T) -> Self {
494 Self {
495 interface: provider.as_cape_array_real_in(),
496 interface_ptr: std::ptr::null_mut(),
497 }
498 }
499 pub fn as_cape_array_real_in(&mut self) -> CapeArrayRealIn<'_> {
500 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayReal;
501 CapeArrayRealIn::new(& self.interface_ptr)
502 }
503}
504
505/// CapeArrayRealOutFromProvider
506///
507/// When calling a CAPE-OPEN method that takes a CapeArrayReal as output,
508/// the caller provides an object that implements `CapeArrayRealProviderOut`,
509/// for example `CapeArrayRealVec`.
510///
511/// The `CapeArrayRealOutFromProvider` returns an `C::ICapeArrayReal` interface, which
512/// has a small life span, enough to make sure that the pointer to this
513/// interface is valid. This is done inside wrapper classes such as
514/// `capeopen_1_2::CapeThermoMaterial`.
515///
516/// When implementing a function that gets called, and takes a CapeArrayReal
517/// as output, it received a `&mut CapeArrayRealOut` typed argument, which is
518/// constructed from the reference to an `C::ICapeArrayReal` interface pointer.
519///
520/// Typically a function call receives the `C::ICapeArrayReal` interface
521/// from the caller, and from this, the `CapeArrayRealOut` is constructed by
522/// the `cape_object_implementation` macro.
523///
524/// In the rare case that one wants to call an internal CAPE-OPEN function
525/// directly, one needs to provide the class that implements the
526/// `CapeArrayRealProviderOut` trait, allocate the pointer, point to it, and
527/// construct the `CapeArrayRealOut` object from a reference to that pointer.
528///
529/// The `CapeArrayRealOutFromProvider` class does all this.
530///
531/// # Example
532/// ```
533/// use cobia::*;
534/// let mut array = CapeArrayRealVec::new();
535/// fn SetArrayOut(array:&mut CapeArrayRealOut) {
536/// array.put_array(&[1.0,2.0,3.0]);
537/// }
538/// SetArrayOut(&mut CapeArrayRealOutFromProvider::from(&mut array).as_cape_array_real_out()); //this is how array is passed as &mut CapeArrayRealOut argument
539/// assert_eq!(array.as_vec(),&vec![1.0,2.0,3.0]);
540/// ```
541
542pub struct CapeArrayRealOutFromProvider {
543 interface: C::ICapeArrayReal,
544 interface_ptr: *mut C::ICapeArrayReal,
545}
546
547impl CapeArrayRealOutFromProvider {
548 pub fn from<T:CapeArrayRealProviderOut>(provider:&mut T) -> Self {
549 Self {
550 interface: provider.as_cape_array_real_out(),
551 interface_ptr: std::ptr::null_mut(),
552 }
553 }
554 pub fn as_cape_array_real_out(&mut self) -> CapeArrayRealOut<'_> {
555 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayReal;
556 CapeArrayRealOut::new(& mut self.interface_ptr)
557 }
558}
559
560/// CapeArrayBooleanInFromProvider
561///
562/// When calling a CAPE-OPEN method that takes a CapeArrayBoolean as input,
563/// the caller provides an object that implements `CapeArrayBooleanProviderIn`,
564/// for example `CapeArrayBooleanVec`.
565///
566/// The `CapeArrayBooleanInFromProvider` returns an `C::ICapeArrayBoolean` interface, which
567/// has a small life span, enough to make sure that the pointer to this
568/// interface is valid. This is done inside wrapper classes such as
569/// `capeopen_1_2::CapeArrayBooleanParameter`.
570///
571/// When implementing a function that gets called, and takes a CapeArrayBoolean
572/// as input, it received a `&CapeArrayBooleanIn` typed argument, which is
573/// constructed from the reference to an `C::ICapeArrayBoolean` interface pointer.
574///
575/// Typically a function call receives the `C::ICapeArrayBoolean` interface
576/// from the caller, and from this, the `CapeArrayBooleanIn` is constructed by
577/// the `cape_object_implementation` macro.
578///
579/// In the rare case that one wants to call an internal CAPE-OPEN function
580/// directly, one needs to provide the class that implements the
581/// `CapeArrayBooleanProviderIn` trait, allocate the pointer, point to it, and
582/// construct the `CapeArrayBooleanIn` object from a reference to that pointer.
583///
584/// The `CapeArrayBooleanInFromProvider` class does all this.
585///
586/// # Example
587/// ```
588/// use cobia::*;
589/// let array = CapeArrayBooleanVec::from_slice(&[true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
590/// fn ArrayFromCapeArrayBooleanIn(array:&CapeArrayBooleanIn) -> Vec<cobia::CapeBoolean> {
591/// array.as_vec()
592/// }
593/// let value=ArrayFromCapeArrayBooleanIn(&CapeArrayBooleanInFromProvider::from(&array).as_cape_array_boolean_in()); //this is how array is passed as &CapeArrayBooleanIn argument
594/// assert_eq!(value,vec![true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
595/// ```
596
597pub struct CapeArrayBooleanInFromProvider {
598 interface: C::ICapeArrayBoolean,
599 interface_ptr: *mut C::ICapeArrayBoolean,
600}
601
602impl CapeArrayBooleanInFromProvider {
603 pub fn from<T:CapeArrayBooleanProviderIn>(provider:&T) -> Self {
604 Self {
605 interface: provider.as_cape_array_boolean_in(),
606 interface_ptr: std::ptr::null_mut(),
607 }
608 }
609 pub fn as_cape_array_boolean_in(&mut self) -> CapeArrayBooleanIn<'_> {
610 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayBoolean;
611 CapeArrayBooleanIn::new(& self.interface_ptr)
612 }
613}
614
615/// CapeArrayBooleanOutFromProvider
616///
617/// When calling a CAPE-OPEN method that takes a CapeArrayBoolean as output,
618/// the caller provides an object that implements `CapeArrayBooleanProviderOut`,
619/// for example `CapeArrayBooleanVec`.
620///
621/// The `CapeArrayBooleanOutFromProvider` returns an `C::ICapeArrayBoolean` interface, which
622/// has a small life span, enough to make sure that the pointer to this
623/// interface is valid. This is done inside wrapper classes such as
624/// `capeopen_1_2::CapeArrayBooleanParameter`.
625///
626/// When implementing a function that gets called, and takes a CapeArrayBoolean
627/// as output, it received a `&mut CapeArrayBooleanOut` typed argument, which is
628/// constructed from the reference to an `C::ICapeArrayBoolean` interface pointer.
629///
630/// Typically a function call receives the `C::ICapeArrayBoolean` interface
631/// from the caller, and from this, the `CapeArrayBooleanOut` is constructed by
632/// the `cape_object_implementation` macro.
633///
634/// In the rare case that one wants to call an internal CAPE-OPEN function
635/// directly, one needs to provide the class that implements the
636/// `CapeArrayBooleanProviderOut` trait, allocate the pointer, point to it, and
637/// construct the `CapeArrayBooleanOut` object from a reference to that pointer.
638///
639/// The `CapeArrayBooleanOutFromProvider` class does all this.
640///
641/// # Example
642/// ```
643/// use cobia::*;
644/// let mut array = CapeArrayBooleanVec::new();
645/// fn SetArrayOut(array:&mut CapeArrayBooleanOut) {
646/// array.put_array(&[true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
647/// }
648/// SetArrayOut(&mut CapeArrayBooleanOutFromProvider::from(&mut array).as_cape_array_boolean_out()); //this is how array is passed as &mut CapeArrayBooleanOut argument
649/// assert_eq!(array.as_vec(),&vec![true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
650/// ```
651
652pub struct CapeArrayBooleanOutFromProvider {
653 interface: C::ICapeArrayBoolean,
654 interface_ptr: *mut C::ICapeArrayBoolean,
655}
656
657impl CapeArrayBooleanOutFromProvider {
658 pub fn from<T:CapeArrayBooleanProviderOut>(provider:&mut T) -> Self {
659 Self {
660 interface: provider.as_cape_array_boolean_out(),
661 interface_ptr: std::ptr::null_mut(),
662 }
663 }
664 pub fn as_cape_array_boolean_out(&mut self) -> CapeArrayBooleanOut<'_> {
665 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayBoolean;
666 CapeArrayBooleanOut::new(& mut self.interface_ptr)
667 }
668}
669
670/// CapeArrayByteInFromProvider
671///
672/// When calling a CAPE-OPEN method that takes a CapeArrayByte as input,
673/// the caller provides an object that implements `CapeArrayByteProviderIn`,
674/// for example `CapeArrayByteVec`.
675///
676/// The `CapeArrayByteInFromProvider` returns an `C::ICapeArrayByte` interface, which
677/// has a small life span, enough to make sure that the pointer to this
678/// interface is valid. This is done inside wrapper classes such as
679/// `capeopen_1_2::CapePersistWriter`.
680///
681/// When implementing a function that gets called, and takes a CapeArrayByte
682/// as input, it received a `&CapeArrayByteIn` typed argument, which is
683/// constructed from the reference to an `C::ICapeArrayByte` interface pointer.
684///
685/// Typically a function call receives the `C::ICapeArrayByte` interface
686/// from the caller, and from this, the `CapeArrayByteIn` is constructed by
687/// the `cape_object_implementation` macro.
688///
689/// In the rare case that one wants to call an internal CAPE-OPEN function
690/// directly, one needs to provide the class that implements the
691/// `CapeArrayByteProviderIn` trait, allocate the pointer, point to it, and
692/// construct the `CapeArrayByteIn` object from a reference to that pointer.
693///
694/// The `CapeArrayByteInFromProvider` class does all this.
695///
696/// # Example
697/// ```
698/// use cobia::*;
699/// let array = CapeArrayByteVec::from_slice(&[1,2,3]);
700/// fn ArrayFromCapeArrayByteIn(array:&CapeArrayByteIn) -> Vec<u8> {
701/// array.as_vec()
702/// }
703/// let value=ArrayFromCapeArrayByteIn(&CapeArrayByteInFromProvider::from(&array).as_cape_array_byte_in()); //this is how array is passed as &CapeArrayByteIn argument
704/// assert_eq!(value,vec![1,2,3]);
705/// ```
706
707pub struct CapeArrayByteInFromProvider {
708 interface: C::ICapeArrayByte,
709 interface_ptr: *mut C::ICapeArrayByte,
710}
711
712impl CapeArrayByteInFromProvider {
713 pub fn from<T:CapeArrayByteProviderIn>(provider:&T) -> Self {
714 Self {
715 interface: provider.as_cape_array_byte_in(),
716 interface_ptr: std::ptr::null_mut(),
717 }
718 }
719 pub fn as_cape_array_byte_in(&mut self) -> CapeArrayByteIn<'_> {
720 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayByte;
721 CapeArrayByteIn::new(& self.interface_ptr)
722 }
723}
724
725/// CapeArrayByteOutFromProvider
726///
727/// When calling a CAPE-OPEN method that takes a CapeArrayByte as output,
728/// the caller provides an object that implements `CapeArrayByteProviderOut`,
729/// for example `CapeArrayByteVec`.
730///
731/// The `CapeArrayByteOutFromProvider` returns an `C::ICapeArrayByte` interface, which
732/// has a small life span, enough to make sure that the pointer to this
733/// interface is valid. This is done inside wrapper classes such as
734/// `capeopen_1_2::CapePersistReader`.
735///
736/// When implementing a function that gets called, and takes a CapeArrayByte
737/// as output, it received a `&mut CapeArrayByteOut` typed argument, which is
738/// constructed from the reference to an `C::ICapeArrayByte` interface pointer.
739///
740/// Typically a function call receives the `C::ICapeArrayByte` interface
741/// from the caller, and from this, the `CapeArrayByteOut` is constructed by
742/// the `cape_object_implementation` macro.
743///
744/// In the rare case that one wants to call an internal CAPE-OPEN function
745/// directly, one needs to provide the class that implements the
746/// `CapeArrayByteProviderOut` trait, allocate the pointer, point to it, and
747/// construct the `CapeArrayByteOut` object from a reference to that pointer.
748///
749/// The `CapeArrayByteOutFromProvider` class does all this.
750///
751/// # Example
752/// ```
753/// use cobia::*;
754/// let mut array = CapeArrayByteVec::new();
755/// fn SetArrayOut(array:&mut CapeArrayByteOut) {
756/// array.put_array(&[1,2,3]);
757/// }
758/// SetArrayOut(&mut CapeArrayByteOutFromProvider::from(&mut array).as_cape_array_byte_out()); //this is how array is passed as &mut CapeArrayByteOut argument
759/// assert_eq!(array.as_vec(),&vec![1,2,3]);
760/// ```
761
762pub struct CapeArrayByteOutFromProvider {
763 interface: C::ICapeArrayByte,
764 interface_ptr: *mut C::ICapeArrayByte,
765}
766
767impl CapeArrayByteOutFromProvider {
768 pub fn from<T:CapeArrayByteProviderOut>(provider:&mut T) -> Self {
769 Self {
770 interface: provider.as_cape_array_byte_out(),
771 interface_ptr: std::ptr::null_mut(),
772 }
773 }
774 pub fn as_cape_array_byte_out(&mut self) -> CapeArrayByteOut<'_> {
775 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayByte;
776 CapeArrayByteOut::new(& mut self.interface_ptr)
777 }
778}
779
780/// CapeArrayValueInFromProvider
781///
782/// When calling a CAPE-OPEN method that takes a CapeArrayValue as input,
783/// the caller provides an object that implements `CapeArrayValueProviderIn`,
784/// for example `CapeArrayValueVec`.
785///
786/// The `CapeArrayValueInFromProvider` returns an `C::ICapeArrayValue` interface, which
787/// has a small life span, enough to make sure that the pointer to this
788/// interface is valid. This is done inside wrapper classes such as
789/// `capeopen_1_2::CapePersistWriter`.
790///
791/// When implementing a function that gets called, and takes a CapeArrayValue
792/// as input, it received a `&CapeArrayValueIn` typed argument, which is
793/// constructed from the reference to an `C::ICapeArrayValue` interface pointer.
794///
795/// Typically a function call receives the `C::ICapeArrayValue` interface
796/// from the caller, and from this, the `CapeArrayValueIn` is constructed by
797/// the `cape_object_implementation` macro.
798///
799/// In the rare case that one wants to call an internal CAPE-OPEN function
800/// directly, one needs to provide the class that implements the
801/// `CapeArrayValueProviderIn` trait, allocate the pointer, point to it, and
802/// construct the `CapeArrayValueIn` object from a reference to that pointer.
803///
804/// The `CapeArrayValueInFromProvider` class does all this.
805///
806/// # Example
807/// ```
808/// use cobia::*;
809/// let array = CapeArrayValueVec::from_slice(&[CapeValueContent::Integer(1),CapeValueContent::Integer(2),CapeValueContent::Integer(3)]);
810/// fn ArrayFromCapeArrayValueIn(array:&CapeArrayValueIn) -> Vec<CapeValueContent> {
811/// array.as_value_vec().unwrap()
812/// }
813/// let value=ArrayFromCapeArrayValueIn(&CapeArrayValueInFromProvider::from(&array).as_cape_array_value_in()); //this is how array is passed as &CapeArrayValueIn argument
814/// assert_eq!(value,vec![CapeValueContent::Integer(1),CapeValueContent::Integer(2),CapeValueContent::Integer(3)]);
815/// ```
816
817pub struct CapeArrayValueInFromProvider {
818 interface: C::ICapeArrayValue,
819 interface_ptr: *mut C::ICapeArrayValue,
820}
821
822impl CapeArrayValueInFromProvider {
823 pub fn from<T:CapeArrayValueProviderIn>(provider:&T) -> Self {
824 Self {
825 interface: provider.as_cape_array_value_in(),
826 interface_ptr: std::ptr::null_mut(),
827 }
828 }
829 pub fn as_cape_array_value_in(&mut self) -> CapeArrayValueIn<'_> {
830 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayValue;
831 CapeArrayValueIn::new(& self.interface_ptr)
832 }
833}
834
835/// CapeArrayValueOutFromProvider
836///
837/// When calling a CAPE-OPEN method that takes a CapeArrayValue as output,
838/// the caller provides an object that implements `CapeArrayValueProviderOut`,
839/// for example `CapeArrayValueVec`.
840///
841/// The `CapeArrayValueOutFromProvider` returns an `C::ICapeArrayValue` interface, which
842/// has a small life span, enough to make sure that the pointer to this
843/// interface is valid. This is done inside wrapper classes such as
844/// `capeopen_1_2::CapePersistReader`.
845///
846/// When implementing a function that gets called, and takes a CapeArrayValue
847/// as output, it received a `&mut CapeArrayValueOut` typed argument, which is
848/// constructed from the reference to an `C::ICapeArrayValue` interface pointer.
849///
850/// Typically a function call receives the `C::ICapeArrayValue` interface
851/// from the caller, and from this, the `CapeArrayValueOut` is constructed by
852/// the `cape_object_implementation` macro.
853///
854/// In the rare case that one wants to call an internal CAPE-OPEN function
855/// directly, one needs to provide the class that implements the
856/// `CapeArrayValueProviderOut` trait, allocate the pointer, point to it, and
857/// construct the `CapeArrayValueOut` object from a reference to that pointer.
858///
859/// The `CapeArrayValueOutFromProvider` class does all this.
860///
861/// # Example
862/// ```
863/// use cobia::*;
864/// let mut array = CapeArrayValueVec::new();
865/// fn SetArrayOut(array:&mut CapeArrayValueOut) {
866/// array.put_array(&[CapeValueContent::Integer(1),CapeValueContent::Integer(2),CapeValueContent::Integer(3)]);
867/// }
868/// SetArrayOut(&mut CapeArrayValueOutFromProvider::from(&mut array).as_cape_array_value_out()); //this is how array is passed as &mut CapeArrayValueOut argument
869/// assert_eq!(array.as_value_vec(),vec![CapeValueContent::Integer(1),CapeValueContent::Integer(2),CapeValueContent::Integer(3)]);
870/// ```
871
872pub struct CapeArrayValueOutFromProvider {
873 interface: C::ICapeArrayValue,
874 interface_ptr: *mut C::ICapeArrayValue,
875}
876
877impl CapeArrayValueOutFromProvider {
878 pub fn from<T:CapeArrayValueProviderOut>(provider:&mut T) -> Self {
879 Self {
880 interface: provider.as_cape_array_value_out(),
881 interface_ptr: std::ptr::null_mut(),
882 }
883 }
884 pub fn as_cape_array_value_out(&mut self) -> CapeArrayValueOut<'_> {
885 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayValue;
886 CapeArrayValueOut::new(& mut self.interface_ptr)
887 }
888}
889
890/// CapeArrayEnumerationInFromProvider
891///
892/// When calling a CAPE-OPEN method that takes a CapeArrayEnumeration as input,
893/// the caller provides an object that implements `CapeArrayEnumerationProviderIn`,
894/// for example `CapeArrayEnumerationVec`.
895///
896/// The `CapeArrayEnumerationInFromProvider` returns an `C::ICapeArrayEnumeration` interface, which
897/// has a small life span, enough to make sure that the pointer to this
898/// interface is valid. This is done inside wrapper classes such as
899/// `capeopen_1_2::CapeArrayRealParameter`.
900///
901/// When implementing a function that gets called, and takes a CapeArrayEnumeration
902/// as input, it received a `&CapeArrayEnumerationIn` typed argument, which is
903/// constructed from the reference to an `C::ICapeArrayEnumeration` interface pointer.
904///
905/// Typically a function call receives the `C::ICapeArrayEnumeration` interface
906/// from the caller, and from this, the `CapeArrayEnumerationIn` is constructed by
907/// the `cape_object_implementation` macro.
908///
909/// In the rare case that one wants to call an internal CAPE-OPEN function
910/// directly, one needs to provide the class that implements the
911/// `CapeArrayEnumerationProviderIn` trait, allocate the pointer, point to it, and
912/// construct the `CapeArrayEnumerationIn` object from a reference to that pointer.
913///
914/// The `CapeArrayEnumerationInFromProvider` class does all this.
915///
916/// # Example
917/// ```
918/// use cobia::*;
919/// let array = cobia::CapeArrayEnumerationVec::from_slice(&[CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
920/// fn ArrayFromCapeArrayEnumerationIn(array:&CapeArrayEnumerationIn<CapePMCServiceType>) -> Vec<CapePMCServiceType> {
921/// array.as_vec()
922/// }
923/// let value=ArrayFromCapeArrayEnumerationIn(&CapeArrayEnumerationInFromProvider::from(&array).as_cape_array_enumeration_in()); //this is how array is passed as &CapeArrayEnumerationIn argument
924/// assert_eq!(value,vec![CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
925/// ```
926
927pub struct CapeArrayEnumerationInFromProvider<Element:Copy+Clone> {
928 interface: C::ICapeArrayEnumeration,
929 interface_ptr: *mut C::ICapeArrayEnumeration,
930 element_type : std::marker::PhantomData<Element>,
931}
932
933impl<Element:Copy+Clone> CapeArrayEnumerationInFromProvider<Element> {
934 pub fn from<T:CapeArrayEnumerationProviderIn>(provider:&T) -> Self {
935 Self {
936 interface: provider.as_cape_array_enumeration_in(),
937 interface_ptr: std::ptr::null_mut(),
938 element_type:std::default::Default::default(),
939 }
940 }
941 pub fn as_cape_array_enumeration_in(&mut self) -> CapeArrayEnumerationIn<'_,Element> {
942 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayEnumeration;
943 CapeArrayEnumerationIn::new(& self.interface_ptr)
944 }
945}
946
947/// CapeArrayEnumerationOutFromProvider
948///
949/// When calling a CAPE-OPEN method that takes a CapeArrayEnumeration as output,
950/// the caller provides an object that implements `CapeArrayEnumerationProviderOut`,
951/// for example `CapeArrayEnumerationVec`.
952///
953/// The `CapeArrayEnumerationOutFromProvider` returns an `C::ICapeArrayEnumeration` interface, which
954/// has a small life span, enough to make sure that the pointer to this
955/// interface is valid. This is done inside wrapper classes such as
956/// `capeopen_1_2::CapeArrayEnumerationParameter`.
957///
958/// When implementing a function that gets called, and takes a CapeArrayEnumeration
959/// as output, it received a `&mut CapeArrayEnumerationOut` typed argument, which is
960/// constructed from the reference to an `C::ICapeArrayEnumeration` interface pointer.
961///
962/// Typically a function call receives the `C::ICapeArrayEnumeration` interface
963/// from the caller, and from this, the `CapeArrayEnumerationOut` is constructed by
964/// the `cape_object_implementation` macro.
965///
966/// In the rare case that one wants to call an internal CAPE-OPEN function
967/// directly, one needs to provide the class that implements the
968/// `CapeArrayEnumerationProviderOut` trait, allocate the pointer, point to it, and
969/// construct the `CapeArrayEnumerationOut` object from a reference to that pointer.
970///
971/// The `CapeArrayEnumerationOutFromProvider` class does all this.
972///
973/// # Example
974/// ```
975/// use cobia::*;
976/// let mut array : CapeArrayEnumerationVec<CapePMCServiceType> = CapeArrayEnumerationVec::new();
977/// fn SetArrayOut(array:&mut CapeArrayEnumerationOut<CapePMCServiceType>) {
978/// array.put_array(&[CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
979/// }
980/// SetArrayOut(&mut CapeArrayEnumerationOutFromProvider::from(&mut array).as_cape_array_enumeration_out()); //this is how array is passed as &mut CapeArrayEnumerationOut argument
981/// assert_eq!(array.as_vec(),&vec![CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
982/// ```
983
984pub struct CapeArrayEnumerationOutFromProvider<Element:Copy+Clone> {
985 interface: C::ICapeArrayEnumeration,
986 interface_ptr: *mut C::ICapeArrayEnumeration,
987 element_type : std::marker::PhantomData<Element>,
988}
989
990impl<Element:Copy+Clone> CapeArrayEnumerationOutFromProvider<Element> {
991 pub fn from<T:CapeArrayEnumerationProviderOut>(provider:&mut T) -> Self {
992 Self {
993 interface: provider.as_cape_array_enumeration_out(),
994 interface_ptr: std::ptr::null_mut(),
995 element_type:std::default::Default::default(),
996 }
997 }
998 pub fn as_cape_array_enumeration_out(&mut self) -> CapeArrayEnumerationOut<'_,Element> {
999 self.interface_ptr=&mut self.interface as *mut C::ICapeArrayEnumeration;
1000 CapeArrayEnumerationOut::new(& mut self.interface_ptr)
1001 }
1002}