1from __future__
import annotations
13 Base class for implementing a custom pipeline.
15 Provides a partial implementation of the IPipeline interface.
16 Can be used as a foundation for creating custom pipeline behavior.
18 @since ids_peak_common 1.1
19 @ingroup ids_peak_common_python_pipeline
25 Saves the current settings of the pipeline and its modules to a file.
27 This base implementation calls `export_settings_to_string()` and
28 writes the resulting string to the specified file path.
31 with open(file_path,
"w", encoding=
"utf-8")
as f:
35 f
"Saving settings to the file {file_path} failed: {e}")
from e
40 Loads the settings of the pipeline and its modules from a file.
42 This base implementation reads the file contents and passes them to
43 `import_settings_from_string()` to restore the pipeline state.
46 with open(file_path,
"r", encoding=
"utf-8")
as f:
51 f
"Loading settings from the file {file_path} failed: {e}"
57 Processes the input data through all pipeline modules
58 and returns the result.
60 This base implementation iterates over all modules returned
61 by `get_modules()`, calling each module's `process()` method in
62 sequence and passing the result along.
64 @param data: The input data to process.
66 @return The processed input.
69 data = module.process(data)
Thrown when an input, output, file or device communication error occurs.
Interface defining the structure and behavior of a processing pipeline.
None import_settings_from_string(self, str settings)
Loads settings for the pipeline and its modules from a string.
Sequence[IModule] _modules(self)
Retrieves the sequence of all modules in the pipeline, in execution order.
str export_settings_to_string(self)
Returns the current settings of the pipeline and its modules as a string.
Base class for implementing a custom pipeline.
None import_settings_from_file(self, str file_path)
Loads the settings of the pipeline and its modules from a file.
Any process(self, Any data)
Processes the input data through all pipeline modules and returns the result.
None export_settings_to_file(self, str file_path)
Saves the current settings of the pipeline and its modules to a file.