pub struct CapeArrayBooleanInFromProvider {
interface: ICapeArrayBoolean,
interface_ptr: *mut ICapeArrayBoolean,
}Expand description
CapeArrayBooleanInFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayBoolean as input,
the caller provides an object that implements CapeArrayBooleanProviderIn,
for example CapeArrayBooleanVec.
The CapeArrayBooleanInFromProvider returns an C::ICapeArrayBoolean 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::CapeArrayBooleanParameter.
When implementing a function that gets called, and takes a CapeArrayBoolean
as input, it received a &CapeArrayBooleanIn typed argument, which is
constructed from the reference to an C::ICapeArrayBoolean interface pointer.
Typically a function call receives the C::ICapeArrayBoolean interface
from the caller, and from this, the CapeArrayBooleanIn 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
CapeArrayBooleanProviderIn trait, allocate the pointer, point to it, and
construct the CapeArrayBooleanIn object from a reference to that pointer.
The CapeArrayBooleanInFromProvider class does all this.
§Example
use cobia::*;
let array = CapeArrayBooleanVec::from_slice(&[true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);
fn ArrayFromCapeArrayBooleanIn(array:&CapeArrayBooleanIn) -> Vec<cobia::CapeBoolean> {
array.as_vec()
}
let value=ArrayFromCapeArrayBooleanIn(&CapeArrayBooleanInFromProvider::from(&array).as_cape_array_boolean_in()); //this is how array is passed as &CapeArrayBooleanIn argument
assert_eq!(value,vec![true as cobia::CapeBoolean,false as cobia::CapeBoolean,true as cobia::CapeBoolean]);Fields§
§interface: ICapeArrayBoolean§interface_ptr: *mut ICapeArrayBoolean