pub struct CapeArrayStringInFromProvider {
interface: ICapeArrayString,
interface_ptr: *mut ICapeArrayString,
}Expand description
CapeArrayStringInFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayString as input,
the caller provides an object that implements CapeArrayStringProviderIn,
for example CapeArrayStringVec.
The CapeArrayStringInFromProvider returns an C::ICapeArrayString 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 CapeArrayString
as input, it received a &CapeArrayStringIn typed argument, which is
constructed from the reference to an C::ICapeArrayString interface pointer.
Typically a function call receives the C::ICapeArrayString interface
from the caller, and from this, the CapeArrayStringIn 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
CapeArrayStringProviderIn trait, allocate the pointer, point to it, and
construct the CapeArrayStringIn object from a reference to that pointer.
The CapeArrayStringInFromProvider class does all this.
§Example
use cobia::*;
let array = CapeArrayStringVec::from_slice(&["Hello","World"]);
fn ArrayFromCapeArrayStringIn(array:&CapeArrayStringIn) -> Vec<String> {
array.as_string_vec()
}
let value=ArrayFromCapeArrayStringIn(&CapeArrayStringInFromProvider::from(&array).as_cape_array_string_in()); //this is how array is passed as &CapeArrayStringIn argument
assert_eq!(value,vec!["Hello".to_string(),"World".to_string()]);Fields§
§interface: ICapeArrayString§interface_ptr: *mut ICapeArrayString