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