IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
PipelineBase.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.IO;
6
8
18
22public abstract class PipelineBase : IPipeline
23{
36 public virtual void ExportSettingsToFile(string filePath)
37 {
38 try
39 {
40 File.WriteAllText(filePath, ExportSettingsToString());
41 }
42 catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
43 {
44 throw new CommonIOException(
45 $"Saving settings to the file {filePath} failed.", ex);
46 }
47 }
48
61 public virtual void ImportSettingsFromFile(string filePath)
62 {
63 try
64 {
65 var settings = File.ReadAllText(filePath);
67 }
68 catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
69 {
70 throw new CommonIOException(
71 $"Loading settings from the file {filePath} failed.", ex);
72 }
73 }
74
91 public virtual object Process(object input)
92 {
93 var data = input;
94
95 foreach (var module in GetModules())
96 {
97 data = module.Process(data);
98 }
99
100 return data;
101 }
102
115 protected abstract IReadOnlyList<IModule> GetModules();
116
118 public abstract string ExportSettingsToString();
119
121 public abstract void ImportSettingsFromString(string settings);
122
124 public abstract void ResetToDefault();
125
127 public abstract string TypeId { get; }
128}
Exception thrown when an I/O operation fails.
Base class for implementing a custom pipeline.
string TypeId
The type identifier of the pipeline.This is a unique string used to identify the specific pipeline im...
string ExportSettingsToString()
Returns the current settings of the pipeline and its modules as a string.A string representation of t...
void ResetToDefault()
Resets the pipeline and its modules to their default state.
virtual void ExportSettingsToFile(string filePath)
Saves the current settings of the pipeline and its modules to a file.
virtual object Process(object input)
Processes the input through all pipeline modules and returns the result.
virtual void ImportSettingsFromFile(string filePath)
Loads the settings of the pipeline and its modules from a file.
void ImportSettingsFromString(string settings)
Loads settings for the pipeline and its modules from a string.
Interface defining the structure and behavior of a processing pipeline.
Definition IPipeline.cs:18