pub struct CapeArrayIntegerOutFromProvider {
interface: ICapeArrayInteger,
interface_ptr: *mut ICapeArrayInteger,
}Expand description
CapeArrayIntegerOutFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayInteger as output,
the caller provides an object that implements CapeArrayIntegerProviderOut,
for example CapeArrayIntegerVec.
The CapeArrayIntegerOutFromProvider 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::CapeArrayIntegerParameter.
When implementing a function that gets called, and takes a CapeArrayInteger
as output, it received a &mut CapeArrayIntegerOut 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 CapeArrayIntegerOut 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
CapeArrayIntegerProviderOut trait, allocate the pointer, point to it, and
construct the CapeArrayIntegerOut object from a reference to that pointer.
The CapeArrayIntegerOutFromProvider class does all this.
§Example
use cobia::*;
let mut array = CapeArrayIntegerVec::new();
fn SetArrayOut(array:&mut CapeArrayIntegerOut) {
array.put_array(&[1,2,3]);
}
SetArrayOut(&mut CapeArrayIntegerOutFromProvider::from(&mut array).as_cape_array_integer_out()); //this is how array is passed as &mut CapeArrayIntegerOut argument
assert_eq!(array.as_vec(),&vec![1,2,3]);Fields§
§interface: ICapeArrayInteger§interface_ptr: *mut ICapeArrayInteger