Type Alias CapeArrayRealSlice

Source
pub type CapeArrayRealSlice<'a> = CapeArraySlice<'a, CapeReal>;
Expand description

Slice based CapeArrayRealIn 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 &[CapeReal].

§Examples

use cobia::*;

fn test_content(a: &CapeArrayRealIn) {
	assert_eq!(a.as_slice(), &[2.5,4.5]);
}
 
let arr = cobia::CapeArrayRealSlice::new(&[2.5,4.5]);
test_content(&CapeArrayRealInFromProvider::from(&arr).as_cape_array_real_in());

Aliased Type§

pub struct CapeArrayRealSlice<'a> {
    slice: &'a [f64],
}

Fields§

§slice: &'a [f64]

Implementations§

Source§

impl<'a> CapeArrayRealSlice<'a>

Source

const VTABLE: ICapeArrayReal_VTable

Interface v-table

Source

extern "C" fn get( me: *mut c_void, data: *mut *mut CapeReal, size: *mut CapeSize, )

Interface member function

Source

extern "C" fn setsize( _: *mut c_void, _: CapeSize, _: *mut *mut CapeReal, ) -> CapeResult

Interface member function

Trait Implementations§

Source§

impl<'a> CapeArrayRealProviderIn for CapeArrayRealSlice<'a>

Source§

fn as_cape_array_real_in(&self) -> ICapeArrayReal

Convert to ICapeArrayReal

Returns a reference to the ICapeArrayReal interface.

§Examples
use cobia::*;
use cobia::prelude::*;
let arr = cobia::CapeArrayRealSlice::new(&[2.5,4.5]);
let mut i_cape_array_real=arr.as_cape_array_real_in();
let i_cape_array_real_ptr=(&i_cape_array_real as *const C::ICapeArrayReal).cast_mut(); //normally a pointer to the interface is received
let a = cobia::CapeArrayRealIn::new(&i_cape_array_real_ptr); //CapeArrayRealIn from *mut C::ICapeArrayReal
assert_eq!(a.as_vec(), vec![2.5,4.5]);