Isis Developer Reference
Pipeline.h
Go to the documentation of this file.
1#ifndef Pipeline_h
2#define Pipeline_h
8/* SPDX-License-Identifier: CC0-1.0 */
9
10#include <vector>
11
12#include <QString>
13
14#include "PipelineApplication.h"
15
16namespace Isis {
17 class FileName;
18
151 class Pipeline {
152 public:
153 Pipeline(const QString &procAppName = "");
154 ~Pipeline();
155
156 void Prepare();
157 void Run();
158
159 void SetInputFile(const char *inputParam);
160 void SetInputFile(const QString &inputParam);
161 void SetInputFile(const char *inputParam, const char *virtualBandsParam);
162 void SetInputFile(const QString &inputParam, const QString &virtualBandsParam);
163 void SetInputListFile(const char *inputParam);
164 void SetInputListFile(const QString &inputParam);
165 void SetInputFile(const FileName &inputFileName);
166 void SetInputListFile(const FileName &inputFileName);
167
168 void SetOutputFile(const char *outputParam);
169 void SetOutputFile(const QString &outputParam);
170 void SetOutputFile(const FileName &outputFile);
171 void SetOutputListFile(const char *outputFileNameParam);
172 void SetOutputListFile(const QString &outputFileNameParam);
173 void SetOutputListFile(const FileName &outputFileNameList);
174 void KeepTemporaryFiles(bool keep);
177 return p_keepTemporary;
178 }
179
180 void AddPause();
181 void AddToPipeline(const QString &appname);
182 void AddToPipeline(const QString &appname, const QString &identifier);
183 PipelineApplication &Application(const QString &identifier);
184 PipelineApplication &Application(const int &index);
185
186 void SetFirstApplication(const QString &appname);
187 void SetLastApplication(const QString &appname);
188
189 friend std::ostream &operator<<(std::ostream &os, Pipeline &pipeline);
190
192 QString Name() const {
193 return p_procAppName;
194 }
196 int Size() const {
197 return (int)p_apps.size();
198 }
199
207 QString OriginalInput(unsigned int branch) {
208 return ((branch < p_originalInput.size()) ? p_originalInput[branch] : "");
209 }
210
213 return p_originalInput.size();
214 }
215
225 if (p_originalBranches.size() > 0){
226 return p_originalBranches.size();
227 }
228 return p_inputBranches.size();
229 }
230
233 std::vector<QString> OriginalBranches() {
234 if (p_originalBranches.size() > 0){
235 return p_originalBranches;
236 }
237 return p_inputBranches;
238 }
239
240 QString FinalOutput(int branch = 0, bool addModifiers = true);
241 QString TemporaryFolder();
242
244
252 void AddOriginalBranch(QString branch){
253 int size = (int)p_inputBranches.size();
254 if (size == 1) {
255 p_originalBranches.push_back(branch);
256 }
257 else {
258 for (int i=0; i<size; i++) {
259 p_originalBranches.push_back(p_inputBranches[i] + "." + branch);
260 }
261 }
262 }
263
271 void SetContinue(bool pbFlag) {
272 p_continue = pbFlag;
273 };
274
275 private:
276 int p_pausePosition;
277 QString p_procAppName;
278 std::vector<QString> p_originalInput;
279 std::vector<QString> p_inputBranches;
280 std::vector<QString> p_originalBranches;
281 std::vector<QString> p_finalOutput;
282 std::vector<QString> p_virtualBands;
283 bool p_keepTemporary;
284 bool p_addedCubeatt;
285 std::vector< PipelineApplication * > p_apps;
286 std::vector< QString > p_appIdentifiers;
287 bool p_outputListNeedsModifiers;
288 bool p_continue;
289 };
290};
291
292#endif
File name manipulation and expansion.
Definition FileName.h:100
This class represents one application in the pipeline.
Definition PipelineApplication.h:46
This class helps to call other Isis Applications in a Pipeline.
Definition Pipeline.h:151
void Run()
This method executes the pipeline.
Definition Pipeline.cpp:199
void SetContinue(bool pbFlag)
Set the continue flag.
Definition Pipeline.h:271
void SetInputFile(const char *inputParam)
This method is used to set the original input file.
Definition Pipeline.cpp:292
int OriginalInputSize()
Returns the number of input files.
Definition Pipeline.h:212
void SetInputListFile(const char *inputParam)
This method is used to set the original input files.
Definition Pipeline.cpp:339
void AddPause()
Add a pause to the pipeline.
Definition Pipeline.cpp:558
int OriginalBranchesSize()
Returns the total number of input branches Original branches = Number of input files * Number of bran...
Definition Pipeline.h:224
friend std::ostream & operator<<(std::ostream &os, Pipeline &pipeline)
bool KeepTemporaryFiles()
Returns true if temporary files will not be deleted, false if they will.
Definition Pipeline.h:176
PipelineApplication & Application(const QString &identifier)
This is an accessor to get a specific PipelineApplication.
Definition Pipeline.cpp:696
QString FinalOutput(int branch=0, bool addModifiers=true)
This gets the final output for the specified branch; this is necessary for the PipelineApplications t...
Definition Pipeline.cpp:805
QString TemporaryFolder()
This method returns the user's temporary folder for temporary files.
Definition Pipeline.cpp:882
void AddOriginalBranch(QString branch)
Start off the branches directly from the pipeline.
Definition Pipeline.h:252
void Prepare()
This method is the core of the pipeline class.
Definition Pipeline.cpp:69
Pipeline(const QString &procAppName="")
This is the one and only Pipeline constructor.
Definition Pipeline.cpp:36
void AddToPipeline(const QString &appname)
Add a new program to the pipeline.
Definition Pipeline.cpp:643
int Size() const
Returns the number of applications in the pipeline.
Definition Pipeline.h:196
~Pipeline()
This destroys the pipeline.
Definition Pipeline.cpp:49
void SetLastApplication(const QString &appname)
This method disables all applications after to this one.
Definition Pipeline.cpp:778
void SetFirstApplication(const QString &appname)
This method disables all applications up to this one.
Definition Pipeline.cpp:748
void EnableAllApplications()
This method re-enables all applications.
Definition Pipeline.cpp:896
void SetOutputFile(const char *outputParam)
This method is used to set the final output file.
Definition Pipeline.cpp:441
QString OriginalInput(unsigned int branch)
Returns the initial input file for the pipeline.
Definition Pipeline.h:207
QString Name() const
Returns the name of the pipeline.
Definition Pipeline.h:192
std::vector< QString > OriginalBranches()
Returns the names of the original branches of the pipeline (input files * branches if any)
Definition Pipeline.h:233
void SetOutputListFile(const char *outputFileNameParam)
This method is used to set an output list file.
Definition Pipeline.cpp:487
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16