Isis 3 Programmer Reference
Pipeline.h
Go to the documentation of this file.
1 #ifndef Pipeline_h
2 #define Pipeline_h
3 
26 #include <vector>
27 
28 #include <QString>
29 
30 #include "PipelineApplication.h"
31 
32 namespace Isis {
33  class FileName;
34 
162  class Pipeline {
163  public:
164  Pipeline(const QString &procAppName = "");
165  ~Pipeline();
166 
167  void Prepare();
168  void Run();
169 
170  void SetInputFile(const char *inputParam);
171  void SetInputFile(const QString &inputParam);
172  void SetInputFile(const char *inputParam, const char *virtualBandsParam);
173  void SetInputFile(const QString &inputParam, const QString &virtualBandsParam);
174  void SetInputListFile(const char *inputParam);
175  void SetInputListFile(const QString &inputParam);
176  void SetInputFile(const FileName &inputFileName);
177  void SetInputListFile(const FileName &inputFileName);
178 
179  void SetOutputFile(const char *outputParam);
180  void SetOutputFile(const QString &outputParam);
181  void SetOutputFile(const FileName &outputFile);
182  void SetOutputListFile(const char *outputFileNameParam);
183  void SetOutputListFile(const QString &outputFileNameParam);
184  void SetOutputListFile(const FileName &outputFileNameList);
185  void KeepTemporaryFiles(bool keep);
188  return p_keepTemporary;
189  }
190 
191  void AddPause();
192  void AddToPipeline(const QString &appname);
193  void AddToPipeline(const QString &appname, const QString &identifier);
194  PipelineApplication &Application(const QString &identifier);
195  PipelineApplication &Application(const int &index);
196 
197  void SetFirstApplication(const QString &appname);
198  void SetLastApplication(const QString &appname);
199 
200  friend std::ostream &operator<<(std::ostream &os, Pipeline &pipeline);
201 
203  QString Name() const {
204  return p_procAppName;
205  }
207  int Size() const {
208  return (int)p_apps.size();
209  }
210 
218  QString OriginalInput(unsigned int branch) {
219  return ((branch < p_originalInput.size()) ? p_originalInput[branch] : "");
220  }
221 
224  return p_originalInput.size();
225  }
226 
236  if (p_originalBranches.size() > 0){
237  return p_originalBranches.size();
238  }
239  return p_inputBranches.size();
240  }
241 
244  std::vector<QString> OriginalBranches() {
245  if (p_originalBranches.size() > 0){
246  return p_originalBranches;
247  }
248  return p_inputBranches;
249  }
250 
251  QString FinalOutput(int branch = 0, bool addModifiers = true);
252  QString TemporaryFolder();
253 
254  void EnableAllApplications();
255 
263  void AddOriginalBranch(QString branch){
264  int size = (int)p_inputBranches.size();
265  if (size == 1) {
266  p_originalBranches.push_back(branch);
267  }
268  else {
269  for (int i=0; i<size; i++) {
270  p_originalBranches.push_back(p_inputBranches[i] + "." + branch);
271  }
272  }
273  }
274 
282  void SetContinue(bool pbFlag) {
283  p_continue = pbFlag;
284  };
285 
286  private:
287  int p_pausePosition;
288  QString p_procAppName;
289  std::vector<QString> p_originalInput;
290  std::vector<QString> p_inputBranches;
291  std::vector<QString> p_originalBranches;
292  std::vector<QString> p_finalOutput;
293  std::vector<QString> p_virtualBands;
296  std::vector< PipelineApplication * > p_apps;
297  std::vector< QString > p_appIdentifiers;
298  bool p_outputListNeedsModifiers;
299  bool p_continue;
300  };
301 };
302 
303 #endif
void SetInputFile(const char *inputParam)
This method is used to set the original input file.
Definition: Pipeline.cpp:286
std::vector< QString > p_inputBranches
Branches for input list.
Definition: Pipeline.h:290
void SetInputListFile(const char *inputParam)
This method is used to set the original input files.
Definition: Pipeline.cpp:333
QString TemporaryFolder()
This method returns the user&#39;s temporary folder for temporary files.
Definition: Pipeline.cpp:886
std::vector< QString > p_finalOutput
The final output file (empty if needs calculated)
Definition: Pipeline.h:292
void SetLastApplication(const QString &appname)
This method disables all applications after to this one.
Definition: Pipeline.cpp:782
void Run()
This method executes the pipeline.
Definition: Pipeline.cpp:193
std::vector< QString > p_appIdentifiers
The strings to identify the pipeline applications.
Definition: Pipeline.h:297
int OriginalInputSize()
Returns the number of input files.
Definition: Pipeline.h:223
File name manipulation and expansion.
Definition: FileName.h:116
~Pipeline()
This destroys the pipeline.
Definition: Pipeline.cpp:43
QString OriginalInput(unsigned int branch)
Returns the initial input file for the pipeline.
Definition: Pipeline.h:218
Pipeline(const QString &procAppName="")
This is the one and only Pipeline constructor.
Definition: Pipeline.cpp:30
bool p_addedCubeatt
True if the "cubeatt" program was added.
Definition: Pipeline.h:295
void SetContinue(bool pbFlag)
Set the continue flag.
Definition: Pipeline.h:282
This class helps to call other Isis Applications in a Pipeline.
Definition: Pipeline.h:162
std::vector< QString > p_virtualBands
The virtual bands string.
Definition: Pipeline.h:293
bool p_keepTemporary
True if keeping temporary files.
Definition: Pipeline.h:294
bool KeepTemporaryFiles()
Returns true if temporary files will not be deleted, false if they will.
Definition: Pipeline.h:187
bool p_continue
continue the execution even if exception is encountered.
Definition: Pipeline.h:299
std::vector< QString > p_originalInput
The original input file.
Definition: Pipeline.h:289
int OriginalBranchesSize()
Returns the total number of input branches Original branches = Number of input files * Number of bran...
Definition: Pipeline.h:235
void SetFirstApplication(const QString &appname)
This method disables all applications up to this one.
Definition: Pipeline.cpp:752
std::vector< PipelineApplication *> p_apps
The pipeline applications.
Definition: Pipeline.h:296
void SetOutputFile(const char *outputParam)
This method is used to set the final output file.
Definition: Pipeline.cpp:446
std::vector< QString > OriginalBranches()
Returns the names of the original branches of the pipeline (input files * branches if any) ...
Definition: Pipeline.h:244
void SetOutputListFile(const char *outputFileNameParam)
This method is used to set an output list file.
Definition: Pipeline.cpp:492
This class represents one application in the pipeline.
void AddToPipeline(const QString &appname)
Add a new program to the pipeline.
Definition: Pipeline.cpp:647
void Prepare()
This method is the core of the pipeline class.
Definition: Pipeline.cpp:63
QString Name() const
Returns the name of the pipeline.
Definition: Pipeline.h:203
int Size() const
Returns the number of applications in the pipeline.
Definition: Pipeline.h:207
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:809
QString p_procAppName
The name of the pipeline.
Definition: Pipeline.h:288
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void AddOriginalBranch(QString branch)
Start off the branches directly from the pipeline.
Definition: Pipeline.h:263
std::vector< QString > p_originalBranches
The input file(s) + original branches from pipeline.
Definition: Pipeline.h:291
void AddPause()
Add a pause to the pipeline.
Definition: Pipeline.cpp:562
PipelineApplication & Application(const QString &identifier)
This is an accessor to get a specific PipelineApplication.
Definition: Pipeline.cpp:700
void EnableAllApplications()
This method re-enables all applications.
Definition: Pipeline.cpp:900