pub struct CapeArrayEnumerationOutFromProvider<Element: Copy + Clone> {
interface: ICapeArrayEnumeration,
interface_ptr: *mut ICapeArrayEnumeration,
element_type: PhantomData<Element>,
}Expand description
CapeArrayEnumerationOutFromProvider
When calling a CAPE-OPEN method that takes a CapeArrayEnumeration as output,
the caller provides an object that implements CapeArrayEnumerationProviderOut,
for example CapeArrayEnumerationVec.
The CapeArrayEnumerationOutFromProvider returns an C::ICapeArrayEnumeration 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::CapeArrayEnumerationParameter.
When implementing a function that gets called, and takes a CapeArrayEnumeration
as output, it received a &mut CapeArrayEnumerationOut typed argument, which is
constructed from the reference to an C::ICapeArrayEnumeration interface pointer.
Typically a function call receives the C::ICapeArrayEnumeration interface
from the caller, and from this, the CapeArrayEnumerationOut 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
CapeArrayEnumerationProviderOut trait, allocate the pointer, point to it, and
construct the CapeArrayEnumerationOut object from a reference to that pointer.
The CapeArrayEnumerationOutFromProvider class does all this.
§Example
use cobia::*;
let mut array : CapeArrayEnumerationVec<CapePMCServiceType> = CapeArrayEnumerationVec::new();
fn SetArrayOut(array:&mut CapeArrayEnumerationOut<CapePMCServiceType>) {
array.put_array(&[CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);
}
SetArrayOut(&mut CapeArrayEnumerationOutFromProvider::from(&mut array).as_cape_array_enumeration_out()); //this is how array is passed as &mut CapeArrayEnumerationOut argument
assert_eq!(array.as_vec(),&vec![CapePMCServiceType::Inproc64,CapePMCServiceType::COM64]);Fields§
§interface: ICapeArrayEnumeration§interface_ptr: *mut ICapeArrayEnumeration§element_type: PhantomData<Element>