use super::{ControlCommandOutput, ControlState, ControlStepDiagnostics, OperatingControlBatch};
use crate::structures::StructureError;
use numr::dtype::DType;
use numr::runtime::Runtime;
#[derive(Debug)]
pub struct OperatingControlTrial<R: Runtime<DType = DType>> {
pub(crate) next: OperatingControlBatch<R>,
}
impl<R: Runtime<DType = DType>> OperatingControlTrial<R> {
pub fn commands(&self) -> Result<Vec<ControlCommandOutput>, StructureError> {
self.next.commands()
}
pub fn states(&self) -> Result<Vec<ControlState>, StructureError> {
self.next.states()
}
pub fn diagnostics(&self) -> Result<ControlStepDiagnostics, StructureError> {
self.next.last_step()?.ok_or_else(|| {
StructureError::numerical("control trial lacks its immediate step witness")
})
}
pub fn into_next(self) -> OperatingControlBatch<R> {
self.next
}
}