IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
ipipeline.py
Go to the documentation of this file.
1from __future__ import annotations
2
3from abc import ABC, abstractmethod
4from typing import Any, Sequence
5
7
8
9class IPipeline(ABC):
10 """!
11 @brief
12 Interface defining the structure and behavior of a processing pipeline.
13
14 A pipeline is composed of multiple modules chained together in a defined order.
15 When an input is processed, each module's `process` function is called sequentially,
16 and the final result is returned.
17
18 @since ids_peak_common 1.1
19 @ingroup ids_peak_common_python_pipeline
20 """
21
22 @abstractmethod
23 def export_settings_to_file(self, file_path: str) -> None:
24 """!
25 @brief
26 Saves the current settings of the pipeline and its modules to a file.
27
28 @param file_path: Path to the file where the settings should be saved.
29 """
30 pass
31
32 @abstractmethod
33 def import_settings_from_file(self, file_path: str) -> None:
34 """!
35 @brief
36 Loads the settings of the pipeline and its modules from a file.
37
38 @param file_path: Path to the file from which settings should be loaded.
39 """
40 pass
41
42 @abstractmethod
43 def export_settings_to_string(self) -> str:
44 """!
45 @brief
46 Returns the current settings of the pipeline and its modules as a string.
47
48 @return A string representation of the pipeline settings.
49 """
50 pass
51
52 @abstractmethod
53 def import_settings_from_string(self, settings: str) -> None:
54 """!
55 @brief
56 Loads settings for the pipeline and its modules from a string.
57
58 @param settings: String containing serialized pipeline settings.
59 """
60 pass
61
62 @abstractmethod
63 def reset_to_default(self) -> None:
64 """!
65 @brief
66 Resets the pipeline and its modules to their default state.
67 """
68 pass
69
70 @abstractmethod
71 def process(self, data: Any) -> Any:
72 """!
73 @brief
74 Processes the input data through all pipeline modules and returns the result.
75
76 The input data is passed through each module in sequence.
77
78 @param data: The input data to process.
79
80 @return The processed input.
81 """
82 pass
83
84 @property
85 @abstractmethod
86 def type(self) -> str:
87 """!
88 @brief
89 Returns the type identifier of the pipeline.
90
91 This is a unique string used to identify the specific pipeline implementation.
92
93 @return A string representing the pipeline type.
94 """
95 pass
96
97 @property
98 @abstractmethod
99 def _modules(self) -> Sequence[IModule]:
100 """!
101 @brief
102 Retrieves the sequence of all modules in the pipeline,
103 in execution order.
104
105 @return A sequence of modules.
106 """
107 pass
Interface defining the structure and behavior of a processing pipeline.
Definition ipipeline.py:9
None reset_to_default(self)
Resets the pipeline and its modules to their default state.
Definition ipipeline.py:63
None import_settings_from_file(self, str file_path)
Loads the settings of the pipeline and its modules from a file.
Definition ipipeline.py:33
None import_settings_from_string(self, str settings)
Loads settings for the pipeline and its modules from a string.
Definition ipipeline.py:53
str type(self)
Returns the type identifier of the pipeline.
Definition ipipeline.py:86
Any process(self, Any data)
Processes the input data through all pipeline modules and returns the result.
Definition ipipeline.py:71
Sequence[IModule] _modules(self)
Retrieves the sequence of all modules in the pipeline, in execution order.
Definition ipipeline.py:99
str export_settings_to_string(self)
Returns the current settings of the pipeline and its modules as a string.
Definition ipipeline.py:43
None export_settings_to_file(self, str file_path)
Saves the current settings of the pipeline and its modules to a file.
Definition ipipeline.py:23