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