pub struct CapeValueOutFromProvider {
interface: ICapeValue,
interface_ptr: *mut ICapeValue,
}Expand description
CapeValueOutFromProvider
When calling a CAPE-OPEN method that takes a CapeValue as output,
the caller provides an object that implements CapeValueProviderOut,
for example CapeValueImpl.
The CapeValueOutFromProvider returns an C::ICapeValue 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::CapeCOSEUtilities.
When implementing a function that gets called, and takes a CapeValue
as output, it received a &mut CapeValueOut typed argument, which is
constructed from the reference to an C::ICapeValue interface pointer.
Typically a function call receives the C::ICapeValue interface
from the caller, and from this, the CapeValueOut 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
CapeValueProviderOut trait, allocate the pointer, point to it, and
construct the CapeValueOut object from a reference to that pointer.
The CapeValueOutFromProvider class does all this.
§Example
use cobia::*;
let mut value = CapeValueImpl::new();
fn SetValueOut(value:&CapeValueOut) {
value.set_integer(8);
}
SetValueOut(&mut CapeValueOutFromProvider::from(&mut value).as_cape_value_out()); //this is how value is passed as &mut CapeValueOut argument
assert_eq!(value.value(),CapeValueContent::Integer(8));Fields§
§interface: ICapeValue§interface_ptr: *mut ICapeValue