pub struct NDArray {
pub unique_id: i32,
pub timestamp: EpicsTimestamp,
pub time_stamp: f64,
pub dims: Vec<NDDimension>,
pub data: NDDataBuffer,
pub attributes: NDAttributeList,
pub codec: Option<Codec>,
pub pool_id: u64,
pub data_size: usize,
}Expand description
N-dimensional array with typed data buffer.
Fields§
§unique_id: i32§timestamp: EpicsTimestamp§time_stamp: f64Separate double-precision timestamp (C++ double timeStamp), independent of epicsTS.
dims: Vec<NDDimension>§data: NDDataBuffer§attributes: NDAttributeList§codec: Option<Codec>§pool_id: u64Identity of the pool that allocated this array (C++ pNDArrayPool).
0 means the array was not allocated through any pool. NDArrayPool::release
verifies this matches its own id before returning the buffer to the free list.
data_size: usizeRequested byte count at allocation time (C++ dataSize). This is the exact
num_elements * element_size requested, NOT the allocator-rounded Vec capacity.
Pool memory accounting adds/subtracts this exact value.
Implementations§
Source§impl NDArray
impl NDArray
Sourcepub fn new(dims: Vec<NDDimension>, data_type: NDDataType) -> Self
pub fn new(dims: Vec<NDDimension>, data_type: NDDataType) -> Self
Create a new NDArray with zeroed buffer matching dimensions.
Sourcepub fn with_data(dims: Vec<NDDimension>, data: NDDataBuffer) -> Self
pub fn with_data(dims: Vec<NDDimension>, data: NDDataBuffer) -> Self
Create an NDArray wrapping an already-built data buffer.
The array is not pool-allocated (pool_id == 0); data_size is taken
from the buffer’s element count. Use this when a producer fills its own
buffer instead of allocating through an crate::ndarray_pool::NDArrayPool.
Sourcepub fn info(&self) -> NDArrayInfo
pub fn info(&self) -> NDArrayInfo
Compute layout info for this array (matching C++ NDArray::getInfo).
For 3D arrays, reads the ColorMode attribute to determine which
dimension is X, Y, and color (RGB1, RGB2, or RGB3 layout).