pub struct CapeObject {
pub(crate) interface: *mut ICapeInterface,
}Expand description
Generic Cape Object smart pointer
This is a generic smart pointer to any CAPE-OPEN object, that points to the basic ICapeInterface interface.
This smart pointer is used when it is not clear what the type of the object is, but it is known that it is a CAPE-OPEN.
#Example
use cobia;
use cobia::prelude::*;
cobia::cape_open_initialize().unwrap();
let pmc_enumerator = cobia::CapePMCEnumerator::new().unwrap();
let ppm_info_result=pmc_enumerator.get_pmc_by_prog_id("COCO_TEA.PropertyPackManager");
match ppm_info_result {
Ok(ppm_info) => {
let ppm_result=ppm_info.create_instance( //ppm_result is a CapeObject
cobia::CapePMCCreationFlags::AllowRestrictedThreading); //we only use the object in this thread
match ppm_result {
Ok(ppm) => {
//show name
let iden_result=cobia::cape_open_1_2::CapeIdentification::from_object(&ppm); //this is how to obtain a particular interface from a CapeObject
match iden_result {
Ok(iden) => {
let mut name = cobia::CapeStringImpl::new();
iden.get_component_name(&mut name).unwrap();
println!("PPM name: {}",name);
}
Err(_) => {
eprintln!("Object does not implement CAPEOPEN_1_2::ICapeIdentification");
}
}
}
Err(err) => {
eprintln!("Cannot find TEA property package manager (not installed?): {err}");
}
};
}
Err(err) => {
eprintln!("Cannot find TEA property package manager (not installed?): {err}");
}
};
cobia::cape_open_cleanup();Fields§
§interface: *mut ICapeInterfaceTrait Implementations§
Source§impl CapeSmartPointer for CapeObject
impl CapeSmartPointer for CapeObject
type Interface = _ICapeInterface
Source§fn as_cape_interface_pointer(&self) -> *mut ICapeInterface
fn as_cape_interface_pointer(&self) -> *mut ICapeInterface
Get the ICapeInterface Read more
Source§fn get_interface_id() -> &'static CapeUUID
fn get_interface_id() -> &'static CapeUUID
Get the interface ID Read more
Source§fn from_object<T: CapeSmartPointer>(
smart_pointer: &T,
) -> Result<Self, COBIAError>
fn from_object<T: CapeSmartPointer>( smart_pointer: &T, ) -> Result<Self, COBIAError>
Get an interface wrapper instance from another object Read more
Source§fn from_interface_pointer(interface: *mut Self::Interface) -> Self
fn from_interface_pointer(interface: *mut Self::Interface) -> Self
Get an interface wrapper instance from an interface pointer of the wrapped type Read more
Source§fn attach(interface: *mut Self::Interface) -> Self
fn attach(interface: *mut Self::Interface) -> Self
Get an interface wrapper instance from an interface pointer of the wrapped type, without adding a reference Read more
Source§fn detach(self) -> *mut Self::Interface
fn detach(self) -> *mut Self::Interface
Return an interface pointer and release ownership, without decreasing a reference Read more
Source§fn from_cape_interface_pointer(
interface: *mut ICapeInterface,
) -> Result<Self, COBIAError>
fn from_cape_interface_pointer( interface: *mut ICapeInterface, ) -> Result<Self, COBIAError>
Get an interface wrapper instance from any interface pointer Read more
Source§impl Clone for CapeObject
impl Clone for CapeObject
Auto Trait Implementations§
impl Freeze for CapeObject
impl RefUnwindSafe for CapeObject
impl !Send for CapeObject
impl !Sync for CapeObject
impl Unpin for CapeObject
impl UnwindSafe for CapeObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more