pub struct CapeArrayRealOutFromProvider {
interface: ICapeArrayReal,
interface_ptr: *mut ICapeArrayReal,
}Expand description
CapeArrayRealOutFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayReal as output,
the caller provides an object that implements CapeArrayRealProviderOut,
for example CapeArrayRealVec.
The CapeArrayRealOutFromProvider returns an C::ICapeArrayReal interface, which
has a small life span, enough to make sure that the pointer to this
interface is valid. This is done inside wrapper classes such as
capeopen_1_2::CapeThermoMaterial.
When implementing a function that gets called, and takes a CapeArrayReal
as output, it received a &mut CapeArrayRealOut typed argument, which is
constructed from the reference to an C::ICapeArrayReal interface pointer.
Typically a function call receives the C::ICapeArrayReal interface
from the caller, and from this, the CapeArrayRealOut is constructed by
the cape_object_implementation macro.
In the rare case that one wants to call an internal CAPE-OPEN function
directly, one needs to provide the class that implements the
CapeArrayRealProviderOut trait, allocate the pointer, point to it, and
construct the CapeArrayRealOut object from a reference to that pointer.
The CapeArrayRealOutFromProvider class does all this.
§Example
use cobia::*;
let mut array = CapeArrayRealVec::new();
fn SetArrayOut(array:&mut CapeArrayRealOut) {
array.put_array(&[1.0,2.0,3.0]);
}
SetArrayOut(&mut CapeArrayRealOutFromProvider::from(&mut array).as_cape_array_real_out()); //this is how array is passed as &mut CapeArrayRealOut argument
assert_eq!(array.as_vec(),&vec![1.0,2.0,3.0]);Fields§
§interface: ICapeArrayReal§interface_ptr: *mut ICapeArrayReal