pub struct CapeArrayRealScalar {
value: CapeReal,
}Expand description
Scalar based CapeArrayRealOut implementation
ICapeArrayReal is passed as data container between CAPE-OPEN functions. It is up to the caller to provide the interface, and its implementation. This class provides a default impementation using a scalar CapeReal.
This class can be used as input and output argument. However, it should only be used as an output argument in case a scalar value is expected, such as for getting the density from a material object, as any attempt to resize the content to anything else but 1 will result in an error.
§Examples
use cobia::*;
fn set_content(a: &mut CapeArrayRealOut) {
a.resize(1);
a[0]=2.5;
}
let mut arr = cobia::CapeArrayRealScalar::new();
set_content(&mut CapeArrayRealOutFromProvider::from(&mut arr).as_cape_array_real_out());
assert_eq!(arr.value(), 2.5);Fields§
§value: CapeRealImplementations§
Source§impl CapeArrayRealScalar
impl CapeArrayRealScalar
Sourceconst VTABLE: ICapeArrayReal_VTable
const VTABLE: ICapeArrayReal_VTable
Interface v-table
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new CapeArrayRealScalar
Creates a new empty CapeArrayRealScalar
§Examples
use cobia;
let arr = cobia::CapeArrayRealScalar::new();
assert!(cobia::CapeReal::is_nan(arr.value()));Sourcepub fn value(&self) -> CapeReal
pub fn value(&self) -> CapeReal
Return value
Returns the value.
§Example
use cobia;
let arr = cobia::CapeArrayRealScalar::from(10.0);
assert_eq!(arr.value(),10.0);Trait Implementations§
Source§impl AsMut<f64> for CapeArrayRealScalar
impl AsMut<f64> for CapeArrayRealScalar
Source§impl CapeArrayRealProviderIn for CapeArrayRealScalar
impl CapeArrayRealProviderIn for CapeArrayRealScalar
Source§fn as_cape_array_real_in(&self) -> ICapeArrayReal
fn as_cape_array_real_in(&self) -> ICapeArrayReal
Convert to ICapeArrayReal
Returns a reference to the ICapeArrayReal interface.
§Examples
use cobia::*;
fn test_content(a: &CapeArrayRealIn) {
assert_eq!(a[0], 0.0);
}
let arr = cobia::CapeArrayRealScalar::from(0.0);
test_content(&CapeArrayRealInFromProvider::from(&arr).as_cape_array_real_in());Source§impl CapeArrayRealProviderOut for CapeArrayRealScalar
impl CapeArrayRealProviderOut for CapeArrayRealScalar
Source§fn as_cape_array_real_out(&mut self) -> ICapeArrayReal
fn as_cape_array_real_out(&mut self) -> ICapeArrayReal
Convert to ICapeArrayReal
Returns a mutable reference to the ICapeArrayReal interface.
§Examples
use cobia::*;
fn set_content(a: &mut CapeArrayRealOut) {
a.resize(1);
a[0]=2.5;
}
let mut arr = cobia::CapeArrayRealScalar::new();
set_content(&mut CapeArrayRealOutFromProvider::from(&mut arr).as_cape_array_real_out());
assert_eq!(arr.value(), 2.5);Source§impl Clone for CapeArrayRealScalar
impl Clone for CapeArrayRealScalar
Source§fn clone(&self) -> CapeArrayRealScalar
fn clone(&self) -> CapeArrayRealScalar
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more