pub(crate) struct ParameterCollection {
name: CapeStringImpl,
description: CapeStringImpl,
parameters: Vec<CapeParameter>,
shared_unit_data: Rc<RefCell<SharedUnitData>>,
parameter_name_map: CapeOpenMap<usize>,
cobia_object_data: ParameterCollectionCobiaObjectData,
}Expand description
A collection of parameters for the distillation shortcut unit.
This collection implements the ICapeIdentification and ICapeCollection<ICapeParameter> interfaces
and provides methods to manage parameters associated with the unit.
Fields§
§name: CapeStringImplThe name of the parameter collection.
description: CapeStringImplThe description of the parameter collection.
parameters: Vec<CapeParameter>The parameters in the collection.
Shared data for the unit, allowing access to common properties.
parameter_name_map: CapeOpenMap<usize>A map to quickly access parameters by their names.
cobia_object_data: ParameterCollectionCobiaObjectDataCobia object data for this object, which contains generated code to provide the native COBIA interfaces
Implementations§
Source§impl ParameterCollection
impl ParameterCollection
fn create_instance( _parameter_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 ParameterCollection
impl ParameterCollection
Sourcefn new(shared_unit_data: Rc<RefCell<SharedUnitData>>) -> Self
fn new(shared_unit_data: Rc<RefCell<SharedUnitData>>) -> Self
Sourcepub(crate) fn add_parameter<T: CapeSmartPointer>(&mut self, parameter: T)
pub(crate) fn add_parameter<T: CapeSmartPointer>(&mut self, parameter: T)
Adds a parameter to the collection.
The parameter’s name is cached for quick look-ups by name.
§Arguments
parameter- A smart pointer to the parameter to be added.
Trait Implementations§
Source§impl Display for ParameterCollection
impl Display for ParameterCollection
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the parameter 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<CapeParameter> for ParameterCollection
impl ICapeCollection<CapeParameter> for ParameterCollection
Source§fn item_by_index(
&mut self,
index: CapeInteger,
) -> Result<CapeParameter, COBIAError>
fn item_by_index( &mut self, index: CapeInteger, ) -> Result<CapeParameter, COBIAError>
Source§fn item_by_name(
&mut self,
name: &CapeStringIn<'_>,
) -> Result<CapeParameter, COBIAError>
fn item_by_name( &mut self, name: &CapeStringIn<'_>, ) -> Result<CapeParameter, COBIAError>
Source§impl ICapeCollectionImpl<CapeParameter> for ParameterCollection
impl ICapeCollectionImpl<CapeParameter> for ParameterCollection
type T = ParameterCollection
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 ParameterCollection
impl ICapeIdentification for ParameterCollection
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>
Sets the name of the component.
This method is not allowed for this parameter collection implementation and will return an error.
Source§fn set_component_description(
&mut self,
_desc: &CapeStringIn<'_>,
) -> Result<(), COBIAError>
fn set_component_description( &mut self, _desc: &CapeStringIn<'_>, ) -> Result<(), COBIAError>
Sets the description of the component.
This method is not allowed for this parameter collection implementation and will return an error.
Source§impl ICapeIdentificationImpl for ParameterCollection
impl ICapeIdentificationImpl for ParameterCollection
type T = ParameterCollection
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 ParameterCollection
impl ICapeInterfaceImpl for ParameterCollection
type T = ParameterCollection
Source§fn get_object_data(&mut self) -> &mut CapeObjectData
fn get_object_data(&mut self) -> &mut CapeObjectData
CapeObjectData structure.