pub(crate) struct PortCollection {
name: CapeStringImpl,
description: CapeStringImpl,
ports: Vec<CapeUnitPort>,
shared_unit_data: Rc<RefCell<SharedUnitData>>,
cobia_object_data: PortCollectionCobiaObjectData,
}Expand description
The PortCollection class implements a CAPE-OPEN 1.2 collection of unit ports for the DistillationShortcutUnit.
It provides methods to manage and access the ports associated with the unit.
Fields§
§name: CapeStringImplThe name of the port collection
description: CapeStringImplThe description of the port collection
ports: Vec<CapeUnitPort>The ports contained in this collection
Shared data for the unit, allowing access to common properties.
cobia_object_data: PortCollectionCobiaObjectDataCobia object data for this object, which contains generated code to provide the native COBIA interfaces
Implementations§
Source§impl PortCollection
impl PortCollection
fn create_instance( _port_collection_boxed_ptr: *mut *mut ICapeInterface, shared_unit_data: Rc<RefCell<SharedUnitData>>, ) -> CapeResult
Sourcepub(crate) fn create<T: CapeSmartPointer>(
shared_unit_data: Rc<RefCell<SharedUnitData>>,
) -> T
pub(crate) fn create<T: CapeSmartPointer>( shared_unit_data: Rc<RefCell<SharedUnitData>>, ) -> T
Create a new instance of the object and return a smart pointer to it
This function panics if the created object does not implement the interface corresponding to the smart pointer to be returned. For a non-panic version, use the try_create() function.
Sourcepub(crate) fn try_create<T: CapeSmartPointer>(
shared_unit_data: Rc<RefCell<SharedUnitData>>,
) -> Result<T, COBIAError>
pub(crate) fn try_create<T: CapeSmartPointer>( shared_unit_data: Rc<RefCell<SharedUnitData>>, ) -> Result<T, COBIAError>
Create a new instance of the object and return a smart pointer to it
This function returns an error if the created object does not implement the interface corresponding to the smart pointer to be returned.
Sourcepub(crate) unsafe fn borrow<T: CapeSmartPointer>(smart_pointer: &T) -> &Self
pub(crate) unsafe fn borrow<T: CapeSmartPointer>(smart_pointer: &T) -> &Self
Get a reference to the object
Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows
§Safety
The user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.
Sourcepub(crate) unsafe fn borrow_mut<T: CapeSmartPointer>(
smart_pointer: &mut T,
) -> &mut Self
pub(crate) unsafe fn borrow_mut<T: CapeSmartPointer>( smart_pointer: &mut T, ) -> &mut Self
Get a mutable reference to the object
Note that as the reference is created from a smart pointer, the reference is valid only as long as the smart pointer is valid. The reference is not checked for multiple borrows
§Safety
This function is unsafe because it allows mutable access to the object. Also the user must ensure that the smart pointer contains a valid object, and that the object is of the type that is being borrowed. It is not possible for the compiler to check this, as the borrow is done through the native object pointer in the interface.
Source§impl PortCollection
impl PortCollection
Trait Implementations§
Source§impl Display for PortCollection
impl Display for PortCollection
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the port collection for display.
The std::fmt::Display interface is used when generating the source name of the object that raises an error.
§Arguments
f- A mutable reference to the formatter where the output will be written.
§Returns
A result indicating whether the formatting was successful or not.
Source§impl ICapeCollection<CapeUnitPort> for PortCollection
impl ICapeCollection<CapeUnitPort> for PortCollection
Source§fn item_by_index(
&mut self,
index: CapeInteger,
) -> Result<CapeUnitPort, COBIAError>
fn item_by_index( &mut self, index: CapeInteger, ) -> Result<CapeUnitPort, COBIAError>
Source§fn item_by_name(
&mut self,
name: &CapeStringIn<'_>,
) -> Result<CapeUnitPort, COBIAError>
fn item_by_name( &mut self, name: &CapeStringIn<'_>, ) -> Result<CapeUnitPort, COBIAError>
Source§impl ICapeCollectionImpl<CapeUnitPort> for PortCollection
impl ICapeCollectionImpl<CapeUnitPort> for PortCollection
type T = PortCollection
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeCollectionImpl<CollectionItem> + ICapeInterfaceImpl,
extern "C" fn raw_item_by_index( me: *mut c_void, index: i32, item: *mut *mut _ICapeInterface, ) -> u32
extern "C" fn raw_item_by_name( me: *mut c_void, name: *mut _ICapeString, item: *mut *mut _ICapeInterface, ) -> u32
extern "C" fn raw_get_count( me: *mut c_void, item_count: *mut i32, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeCollection_VTable = _
Source§impl ICapeIdentification for PortCollection
impl ICapeIdentification for PortCollection
Source§fn get_component_name(
&mut self,
name: &mut CapeStringOut<'_>,
) -> Result<(), COBIAError>
fn get_component_name( &mut self, name: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>
Source§fn get_component_description(
&mut self,
description: &mut CapeStringOut<'_>,
) -> Result<(), COBIAError>
fn get_component_description( &mut self, description: &mut CapeStringOut<'_>, ) -> Result<(), COBIAError>
Source§fn set_component_name(
&mut self,
_name: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn set_component_name( &mut self, _name: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Source§fn set_component_description(
&mut self,
_desc: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn set_component_description( &mut self, _desc: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Source§impl ICapeIdentificationImpl for PortCollection
impl ICapeIdentificationImpl for PortCollection
type T = PortCollection
fn as_interface_pointer(&mut self) -> *mut ICapeInterface
§fn init_interface() -> _ICapeInterface
fn init_interface() -> _ICapeInterface
fn init<Timpl>(u: &mut Timpl)where
Timpl: ICapeIdentificationImpl + ICapeInterfaceImpl,
extern "C" fn raw_get_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32
extern "C" fn raw_set_component_name( me: *mut c_void, name: *mut _ICapeString, ) -> u32
extern "C" fn raw_get_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32
extern "C" fn raw_set_component_description( me: *mut c_void, desc: *mut _ICapeString, ) -> u32
const VTABLE: CAPEOPEN_1_2_ICapeIdentification_VTable = _
Source§impl ICapeInterfaceImpl for PortCollection
impl ICapeInterfaceImpl for PortCollection
type T = PortCollection
Source§fn get_object_data(&mut self) -> &mut CapeObjectData
fn get_object_data(&mut self) -> &mut CapeObjectData
CapeObjectData structure.