pub struct CapeArrayIntegerInFromProvider {
interface: ICapeArrayInteger,
interface_ptr: *mut ICapeArrayInteger,
}Expand description
CapeArrayIntegerInFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayInteger as input,
the caller provides an object that implements CapeArrayIntegerProviderIn,
for example CapeArrayIntegerVec.
The CapeArrayIntegerInFromProvider returns an C::ICapeArrayInteger 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::CapeArrayRealParameter.
When implementing a function that gets called, and takes a CapeArrayInteger
as input, it received a &CapeArrayIntegerIn typed argument, which is
constructed from the reference to an C::ICapeArrayInteger interface pointer.
Typically a function call receives the C::ICapeArrayInteger interface
from the caller, and from this, the CapeArrayIntegerIn 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
CapeArrayIntegerProviderIn trait, allocate the pointer, point to it, and
construct the CapeArrayIntegerIn object from a reference to that pointer.
The CapeArrayIntegerInFromProvider class does all this.
§Example
use cobia::*;
let array = CapeArrayIntegerVec::from_slice(&[1,2,3]);
fn ArrayFromCapeArrayIntegerIn(array:&CapeArrayIntegerIn) -> Vec<i32> {
array.as_vec()
}
let value=ArrayFromCapeArrayIntegerIn(&CapeArrayIntegerInFromProvider::from(&array).as_cape_array_integer_in()); //this is how array is passed as &CapeArrayIntegerIn argument
assert_eq!(value,vec![1,2,3]);Fields§
§interface: ICapeArrayInteger§interface_ptr: *mut ICapeArrayInteger