pub struct FilePluginController<W: NDFileWriter> {
pub file_base: NDPluginFileBase,
pub writer: W,
pub params: FileParamIndices,
pub auto_save: bool,
pub capture_active: bool,
pub lazy_open: bool,
pub delete_driver_file: bool,
pub latest_array: Option<Arc<NDArray>>,
/* private fields */
}Expand description
Generic file plugin controller that wraps any NDFileWriter with the full C ADCore NDPluginFile control-plane logic: auto_save, capture, stream, temp_suffix rename, create_dir, param updates, error reporting.
Each file format plugin (TIFF, HDF5, JPEG) creates one of these and
delegates process_array, register_params, and on_param_change to it.
§Capture state invariant (B8)
MUST: capture_active, file_base.capture_buffer / file_base.is_open,
file_base.num_captured and the CAPTURE PV are only mutated together,
and only through start_capture() / stop_capture(). No other method may
flip capture_active directly. This makes capture start/stop a single
owned transition so a mode switch or buffer-full event cannot leave the
state inconsistent (e.g. a stream open while capture_active is false).
Fields§
§file_base: NDPluginFileBase§writer: W§params: FileParamIndices§auto_save: bool§capture_active: boolCapture/stream-in-progress flag. INVARIANT: only start_capture /
stop_capture may write this (B8).
lazy_open: bool§delete_driver_file: bool§latest_array: Option<Arc<NDArray>>Implementations§
Source§impl<W: NDFileWriter> FilePluginController<W>
impl<W: NDFileWriter> FilePluginController<W>
pub fn new(writer: W) -> Self
Sourcepub fn set_port_name(&mut self, name: impl Into<String>)
pub fn set_port_name(&mut self, name: impl Into<String>)
Set this plugin’s asyn port name (used for FilePluginDestination routing, G9). Called once during plugin construction.
Sourcepub fn register_params(&mut self, base: &mut PortDriverBase) -> AsynResult<()>
pub fn register_params(&mut self, base: &mut PortDriverBase) -> AsynResult<()>
Look up all standard file param indices from the port driver base.
Sourcepub fn process_array(&mut self, array: &NDArray) -> ProcessResult
pub fn process_array(&mut self, array: &NDArray) -> ProcessResult
Process an incoming array: auto_save, capture buffering, stream write.
Sourcepub fn on_param_change(
&mut self,
reason: usize,
params: &PluginParamSnapshot,
) -> ParamChangeResult
pub fn on_param_change( &mut self, reason: usize, params: &PluginParamSnapshot, ) -> ParamChangeResult
Handle a control-plane param change. Returns true if the reason was handled.