Isis Developer Reference
Pipeline.h
Go to the documentation of this file.
1 #ifndef Pipeline_h
2 #define Pipeline_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <vector>
11 
12 #include <QString>
13 
14 #include "PipelineApplication.h"
15 
16 namespace 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 
243  void EnableAllApplications();
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
Isis::Pipeline::SetOutputFile
void SetOutputFile(const char *outputParam)
This method is used to set the final output file.
Definition: Pipeline.cpp:441
Isis::PipelineApplication::SetNext
void SetNext(PipelineApplication *next)
Link to the next application in the pipeline.
Definition: PipelineApplication.h:153
Isis::Pipeline::SetLastApplication
void SetLastApplication(const QString &appname)
This method disables all applications after to this one.
Definition: Pipeline.cpp:778
FileName.h
Isis::Application
Definition: Application.h:101
Isis::PipelineApplication
This class represents one application in the pipeline.
Definition: PipelineApplication.h:46
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Pipeline::operator<<
friend std::ostream & operator<<(std::ostream &os, Pipeline &pipeline)
Isis::operator<<
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:314
Isis::IException::print
void print() const
Prints a string representation of this exception to stderr.
Definition: IException.cpp:445
IsisAml::GetAsString
QString GetAsString(const QString &paramName) const
Allows the retrieval of a value for a parameter of any type.
Definition: IsisAml.cpp:537
Isis::Progress::CheckStatus
void CheckStatus()
Checks and updates the status.
Definition: Progress.cpp:105
Isis::Pipeline::KeepTemporaryFiles
void KeepTemporaryFiles(bool keep)
Set whether or not to keep temporary files (files generated in the middle of the pipeline that are ne...
Definition: Pipeline.cpp:546
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::FileList::write
void write(FileName outputFileList)
writes to a FileName obj
Definition: FileList.cpp:158
Isis::Progress::SetMaximumSteps
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
Definition: Progress.cpp:85
PipelineApplication.h
Isis::PipelineApplication::Previous
PipelineApplication * Previous() const
This returns the last enabled pipeline application or null.
Definition: PipelineApplication.h:177
Isis::Pipeline::Pipeline
Pipeline(const QString &procAppName="")
This is the one and only Pipeline constructor.
Definition: Pipeline.cpp:36
Isis::Pipeline::TemporaryFolder
QString TemporaryFolder()
This method returns the user's temporary folder for temporary files.
Definition: Pipeline.cpp:882
IsisAml::GetFileName
QString GetFileName(const QString &paramName, QString extension="") const
Allows the retrieval of a value for a parameter of type "filename".
Definition: IsisAml.cpp:607
Isis::Pipeline::AddOriginalBranch
void AddOriginalBranch(QString branch)
Start off the branches directly from the pipeline.
Definition: Pipeline.h:252
Pipeline.h
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::PipelineApplication::TemporaryFiles
std::vector< QString > TemporaryFiles()
This method returns a list of the temporary files generated by this program.
Definition: PipelineApplication.cpp:799
Isis::PipelineApplication::OutputExtension
QString OutputExtension()
This returns this application's output file name's extension.
Definition: PipelineApplication.h:140
Isis::Pipeline::FinalOutput
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
QStringList
Preference.h
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
IsisAml::GetInputAttribute
Isis::CubeAttributeInput & GetInputAttribute(const QString &paramName)
Gets the attributes for an input cube.
Definition: IsisAml.cpp:1874
Isis::Pipeline::SetFirstApplication
void SetFirstApplication(const QString &appname)
This method disables all applications up to this one.
Definition: Pipeline.cpp:748
Isis::ProgramLauncher::RunIsisProgram
static void RunIsisProgram(QString isisProgramName, QString arguments)
Executes the Isis program with the given arguments.
Definition: ProgramLauncher.cpp:37
Isis::PipelineApplication::SetPrevious
void SetPrevious(PipelineApplication *prev)
Link to the previous application in the pipeline.
Definition: PipelineApplication.h:163
Isis::FileName::baseName
QString baseName() const
Returns the name of the file without the path and without extensions.
Definition: FileName.cpp:145
Isis::Application::GetUserInterface
static UserInterface & GetUserInterface()
Returns the UserInterface object.
Definition: Application.cpp:463
FileList.h
Isis::Pipeline::OriginalBranches
std::vector< QString > OriginalBranches()
Returns the names of the original branches of the pipeline (input files * branches if any)
Definition: Pipeline.h:233
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::Pipeline::SetInputListFile
void SetInputListFile(const char *inputParam)
This method is used to set the original input files.
Definition: Pipeline.cpp:339
Isis::Pipeline::KeepTemporaryFiles
bool KeepTemporaryFiles()
Returns true if temporary files will not be deleted, false if they will.
Definition: Pipeline.h:176
Isis::Pipeline::SetContinue
void SetContinue(bool pbFlag)
Set the continue flag.
Definition: Pipeline.h:271
Isis::PipelineApplication::Name
const QString & Name() const
Get the name of this pipeline application.
Definition: PipelineApplication.h:78
Isis::Pipeline::AddToPipeline
void AddToPipeline(const QString &appname)
Add a new program to the pipeline.
Definition: Pipeline.cpp:643
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::Pipeline::SetInputFile
void SetInputFile(const char *inputParam)
This method is used to set the original input file.
Definition: Pipeline.cpp:292
Isis::PipelineApplication::OutputBranches
const std::vector< QString > & OutputBranches() const
Get the branches this program has as output.
Definition: PipelineApplication.h:90
Isis::Pipeline::Name
QString Name() const
Returns the name of the pipeline.
Definition: Pipeline.h:192
Isis::Progress::SetText
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Definition: Progress.cpp:61
Application.h
Isis::Pipeline::OriginalInput
QString OriginalInput(unsigned int branch)
Returns the initial input file for the pipeline.
Definition: Pipeline.h:207
Isis::Pipeline::OriginalInputSize
int OriginalInputSize()
Returns the number of input files.
Definition: Pipeline.h:212
Isis::Application::Name
static QString Name()
Returns the name of the application.
Definition: Application.cpp:729
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Pipeline::EnableAllApplications
void EnableAllApplications()
This method re-enables all applications.
Definition: Pipeline.cpp:896
Isis::Progress
Program progress reporter.
Definition: Progress.h:42
Isis::PipelineApplication::OutputNameModifier
QString OutputNameModifier()
This returns this application's output name modifier.
Definition: PipelineApplication.h:136
Isis::PipelineApplication::Enabled
const bool & Enabled() const
Returns true if this program will be run.
Definition: PipelineApplication.h:113
Isis::Pipeline::Run
void Run()
This method executes the pipeline.
Definition: Pipeline.cpp:199
Isis::Pipeline
This class helps to call other Isis Applications in a Pipeline.
Definition: Pipeline.h:151
Isis::Pipeline::Size
int Size() const
Returns the number of applications in the pipeline.
Definition: Pipeline.h:196
IsisAml::WasEntered
bool WasEntered(const QString &paramName) const
Returns a true if the parameter has a value, and false if it does not.
Definition: IsisAml.cpp:1836
IException.h
Isis::Pipeline::Application
PipelineApplication & Application(const QString &identifier)
This is an accessor to get a specific PipelineApplication.
Definition: Pipeline.cpp:696
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
ProgramLauncher.h
Isis::UserInterface
Command Line and Xml loader, validation, and access.
Definition: UserInterface.h:140
Isis::PipelineApplication::ParamString
const std::vector< QString > & ParamString() const
Get the parameters for running this program; one element in the vector per run.
Definition: PipelineApplication.h:82
Isis::Pipeline::SetOutputListFile
void SetOutputListFile(const char *outputFileNameParam)
This method is used to set an output list file.
Definition: Pipeline.cpp:487
Isis::Preference::Preferences
static Preference & Preferences(bool unitTest=false)
Definition: Preference.cpp:86
Isis::FileName::original
QString original() const
Returns the full file name including the file path.
Definition: FileName.cpp:212
Isis::Pipeline::Prepare
void Prepare()
This method is the core of the pipeline class.
Definition: Pipeline.cpp:69
Isis::FileList
Internalizes a list of files.
Definition: FileList.h:54
Isis::Pipeline::~Pipeline
~Pipeline()
This destroys the pipeline.
Definition: Pipeline.cpp:49
Progress.h
Isis::Pipeline::OriginalBranchesSize
int OriginalBranchesSize()
Returns the total number of input branches Original branches = Number of input files * Number of bran...
Definition: Pipeline.h:224
Isis::FileName::path
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:103
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Pipeline::AddPause
void AddPause()
Add a pause to the pipeline.
Definition: Pipeline.cpp:558