Isis 3 Programmer Reference
|
This class represents one application in the pipeline. More...
#include <PipelineApplication.h>
Public Types | |
enum | NameModifierType { ConstantStrings } |
This is used for branches. More... | |
enum | CustomParameterValue { LastOutput, LastAppOutputList, LastAppOutputListNoMerge } |
This is used to set custom values that must be calculated on the fly. More... | |
Public Member Functions | |
PipelineApplication (QString appName, Pipeline *pipe) | |
Constructs the first pipeline application. More... | |
PipelineApplication (QString appName, PipelineApplication *previous) | |
Constructs subsequent pipeline applications. More... | |
~PipelineApplication () | |
This is the destructor. More... | |
const QString & | Name () const |
Get the name of this pipeline application. More... | |
const std::vector< QString > & | ParamString () const |
Get the parameters for running this program; one element in the vector per run. More... | |
const std::vector< QString > & | InputBranches () const |
Get the branches this program expects as input. More... | |
const std::vector< QString > & | OutputBranches () const |
Get the branches this program has as output. More... | |
void | Enable () |
This method enables this program to be run. More... | |
void | Disable () |
This method disables this program, causing it to be ignored. More... | |
const bool & | Enabled () const |
Returns true if this program will be run. More... | |
void | SetInputParameter (const QString &inputParamName, bool supportsVirtualBands) |
Set the input parameter for this application and whether or not this application supports the virtual bands functionality. More... | |
void | SetInputParameter (const QString &inputParamName, CustomParameterValue value, bool supportsVirtualBands) |
Set the input parameter for this application and whether or not this application supports the virtual bands functionality. More... | |
void | SetOutputParameter (const QString &outputParamName, const QString &outNameModifier, const QString &outFileExtension="cub") |
Set the output parameter for this application and it's naming convention. More... | |
void | SetOutputParameter (const QString &branch, const QString &outputParamName, const QString &outNameModifier, const QString &outFileExtension) |
Set the output parameter for a branch of this application and it's naming convention. More... | |
void | AddBranch (const QString &modString, NameModifierType type) |
This method adds branch to this program. More... | |
void | AddParameter (const QString &inputParamName, const QString &appParamName) |
This method adds knowledge of a parameter to the application. More... | |
void | AddParameter (const QString &branch, const QString &inputParamName, const QString &appParamName) |
This method adds knowledge of a parameter to this application, that will only affect the specified branch. More... | |
void | AddConstParameter (const QString &appParamName, const QString &appParamValue) |
This method adds a parameter to this application with a known value (does not get it from the user interface, must be specified). More... | |
void | AddConstParameter (const QString &branch, const QString &appParamName, const QString &appParamValue) |
This method adds a parameter to this application with a known value (does not get it from the user interface, must be specified) that only affects a single branch. More... | |
void | AddParameter (const QString &appParamName, CustomParameterValue value) |
This method adds a parameter with a calculated value (special) to this application. More... | |
void | AddParameter (const QString &branch, const QString &appParamName, CustomParameterValue value) |
This method adds a parameter with a calculated value (special) to this application that only affects the specified branch. More... | |
QString | OutputNameModifier () |
This returns this application's output name modifier. More... | |
QString | OutputExtension () |
This returns this application's output file name's extension. More... | |
std::vector< QString > & | GetOutputs () |
This returns this application's output files. Only valid after BuildParamString is called. More... | |
std::vector< QString > | TemporaryFiles () |
This method returns a list of the temporary files generated by this program. More... | |
void | SetNext (PipelineApplication *next) |
Link to the next application in the pipeline. More... | |
void | SetPrevious (PipelineApplication *prev) |
Link to the previous application in the pipeline. More... | |
void | BuildParamString () |
This method calculates the inputs, outputs and necessary calls to this program for the pipeline. More... | |
PipelineApplication * | Next () const |
This returns the next enabled pipeline application or null. More... | |
PipelineApplication * | Previous () const |
This returns the last enabled pipeline application or null. More... | |
PipelineApplication * | PreviousOutputer () const |
This returns the previous enabled pipeline application that makes output or null. More... | |
bool | SupportsVirtualBands () |
Returns true if virtual bands are supported. More... | |
void | SetVirtualBands (std::vector< QString > bands) |
Set the virtual bands that this application is to apply. More... | |
void | EnableBranch (QString branch, bool flag) |
Enable/Disable Branch given the branch name. More... | |
bool | BranchEnabled (int branch) |
Check whether a branch is enabled given branch index. More... | |
void | SetContinue (bool pbFlag) |
Set the continue flag status. More... | |
bool | Continue (void) |
Get the continue flag status. More... | |
Private Member Functions | |
bool | FutureOutputFileCreated () |
Returns true if a future application creates output. More... | |
bool | LastApplicationWithOutput () |
Returns true if this is the last application with output. More... | |
Pipeline * | GetPipeline () |
Returns the pipeline. More... | |
bool | Branches () |
Return true is this application does branch (one input branch, multiple output) More... | |
bool | Merges () |
Returns true if this application does merge branches (multiple input branches, one output) More... | |
bool | StringStartsWith (QString from, QString compare) |
String comparison helper, returns true if from starts with compare bool. More... | |
QString | CalculateInputFile (int branch) |
This method calculates the input file for the specified branch. More... | |
QString | CalculateOutputFile (int branch) |
This method calculates the output file for the specified branch. More... | |
QString | GetRealLastOutput (bool skipOne=false) |
This method is used to calculate the value for CustomParameterValue::LastOutput. More... | |
PipelineParameter & | GetInputParameter (int branch) |
This gets the input parameter for the specified branch. More... | |
int | FindBranch (QString name, bool input=true) |
The method, given a string, finds the index of a branch. More... | |
Private Attributes | |
bool | p_continue |
Continue the pipeline execution even if an error is encountered by this app. More... | |
bool | p_enabled |
This application enabled? More... | |
bool | p_supportsVirtualBands |
This application supports virtual bands? More... | |
QString | p_name |
Name of this application. More... | |
std::vector< QString > | p_outputs |
Actual output files. More... | |
std::vector< QString > | p_tempFiles |
Actial temporary files. More... | |
std::vector< QString > | p_paramString |
Built parameter strings. More... | |
std::vector< QString > | p_inBranches |
Input branches. More... | |
std::vector< QString > | p_outBranches |
Output branches. More... | |
std::vector< bool > | p_enableBranch |
Branch enabled/disabled. More... | |
std::vector< PipelineParameter > | p_output |
Output parameters. More... | |
QString | p_outputMod |
Output file name modifier. More... | |
QString | p_outputExtension |
Output file name extension. More... | |
std::vector< QString > | p_virtualBands |
Virtual bands string to add (empty if none) More... | |
std::vector< PipelineParameter > | p_input |
Input parameters. More... | |
std::vector< PipelineParameter > | p_params |
Regular parameters. More... | |
PipelineApplication * | p_previous |
Previous pipeline application. More... | |
PipelineApplication * | p_next |
Next pipeline application. More... | |
Pipeline * | p_pipeline |
The pipeline. More... | |
This class represents one application in the pipeline.
This contains methods for setting application-specific parameters, such as application inputs and outputs. Only pipeline should be instantiating these!
The applications work as a doubly-linked list in order to calculate inputs and outputs correctly. Calling SetNext or SetPrevious is not recommended.
Definition at line 46 of file PipelineApplication.h.
This is used to set custom values that must be calculated on the fly.
Definition at line 66 of file PipelineApplication.h.
This is used for branches.
Right now, only known strings can be used to specify each branch.
Enumerator | |
---|---|
ConstantStrings | Known strings. |
Definition at line 58 of file PipelineApplication.h.
Isis::PipelineApplication::PipelineApplication | ( | QString | appName, |
Pipeline * | pipe | ||
) |
Constructs the first pipeline application.
appName | The name of this application |
pipe | The pipeline |
Definition at line 25 of file PipelineApplication.cpp.
References Isis::Pipeline::OriginalBranches().
Isis::PipelineApplication::PipelineApplication | ( | QString | appName, |
PipelineApplication * | previous | ||
) |
Constructs subsequent pipeline applications.
appName | The name of this application |
previous | The previously last pipeline application |
Definition at line 55 of file PipelineApplication.cpp.
References GetPipeline().
|
inline |
This is the destructor.
Definition at line 52 of file PipelineApplication.h.
void Isis::PipelineApplication::AddBranch | ( | const QString & | modString, |
NameModifierType | type | ||
) |
This method adds branch to this program.
A branch means with one input, multiple outputs are automatically created.
Example:
In this code, thm2isis could actually create output.even.cub and output.odd.cub. The branches are then "even" and "odd". This is used only for the case where the program outputs multiple images based upon one "TO" parameter.
modString | Branch name |
type | Modifier type; currently only supports constant strings |
Definition at line 163 of file PipelineApplication.cpp.
References Isis::IException::Programmer.
void Isis::PipelineApplication::AddConstParameter | ( | const QString & | appParamName, |
const QString & | appParamValue | ||
) |
This method adds a parameter to this application with a known value (does not get it from the user interface, must be specified).
appParamName | Name of the parameter |
appParamValue | Value of the parameter |
Definition at line 244 of file PipelineApplication.cpp.
void Isis::PipelineApplication::AddConstParameter | ( | const QString & | branch, |
const QString & | appParamName, | ||
const QString & | appParamValue | ||
) |
This method adds a parameter to this application with a known value (does not get it from the user interface, must be specified) that only affects a single branch.
branch | Branch this parameter affects |
appParamName | Name of the parameter |
appParamValue | Value of the parameter |
Definition at line 270 of file PipelineApplication.cpp.
void Isis::PipelineApplication::AddParameter | ( | const QString & | appParamName, |
CustomParameterValue | value | ||
) |
This method adds a parameter with a calculated value (special) to this application.
appParamName | Parameter name |
value | Value type |
Definition at line 282 of file PipelineApplication.cpp.
void Isis::PipelineApplication::AddParameter | ( | const QString & | branch, |
const QString & | appParamName, | ||
CustomParameterValue | value | ||
) |
This method adds a parameter with a calculated value (special) to this application that only affects the specified branch.
branch | Branch this parameter affects |
appParamName | Parameter name |
value | Value type |
Definition at line 295 of file PipelineApplication.cpp.
void Isis::PipelineApplication::AddParameter | ( | const QString & | branch, |
const QString & | inputParamName, | ||
const QString & | appParamName | ||
) |
This method adds knowledge of a parameter to this application, that will only affect the specified branch.
The parameter value is taken directly from the user interface; internal defaults are supported by not using the parameter.
branch | The branch this parameter affects |
inputParamName | Parameter in the proc program |
appParamName | Parameter in the this application |
Definition at line 228 of file PipelineApplication.cpp.
References IsisAml::GetAsString(), Isis::Application::GetUserInterface(), and IsisAml::WasEntered().
void Isis::PipelineApplication::AddParameter | ( | const QString & | inputParamName, |
const QString & | appParamName | ||
) |
This method adds knowledge of a parameter to the application.
The parameter value is taken directly from the user interface.
inputParamName | Parameter in the proc program |
appParamName | Parameter in this application |
Definition at line 210 of file PipelineApplication.cpp.
References IsisAml::GetAsString(), Isis::Application::GetUserInterface(), and IsisAml::WasEntered().
|
inline |
Check whether a branch is enabled given branch index.
branch | - index into the branch |
Definition at line 218 of file PipelineApplication.h.
References p_enableBranch.
Referenced by BuildParamString(), and CalculateInputFile().
|
inlineprivate |
Return true is this application does branch (one input branch, multiple output)
Definition at line 255 of file PipelineApplication.h.
References p_inBranches, and p_outBranches.
Referenced by CalculateInputFile().
void Isis::PipelineApplication::BuildParamString | ( | ) |
This method calculates the inputs, outputs and necessary calls to this program for the pipeline.
This should only be used by Pipeline.
Definition at line 308 of file PipelineApplication.cpp.
References Isis::FileName::baseName(), BranchEnabled(), GetOutputs(), Isis::PipelineParameter::IsSpecial(), Isis::IsSpecial(), Name(), OutputBranches(), Previous(), Isis::IException::Programmer, and Isis::PipelineParameter::Special().
|
private |
This method calculates the input file for the specified branch.
branch | Branch this input file affects |
Definition at line 519 of file PipelineApplication.cpp.
References BranchEnabled(), Branches(), GetOutputs(), Previous(), and Isis::IException::Programmer.
|
private |
This method calculates the output file for the specified branch.
branch | Branch this output file is for |
Definition at line 590 of file PipelineApplication.cpp.
References Isis::FileName::baseName(), and Isis::FileName::path().
|
inline |
Get the continue flag status.
Definition at line 242 of file PipelineApplication.h.
References p_continue.
|
inline |
This method disables this program, causing it to be ignored.
Definition at line 108 of file PipelineApplication.h.
References p_enabled.
|
inline |
This method enables this program to be run.
Definition at line 103 of file PipelineApplication.h.
References p_enabled.
|
inline |
Enable/Disable Branch given the branch name.
branch | - branch name |
flag | - true/false |
Definition at line 202 of file PipelineApplication.h.
References p_enableBranch, and p_inBranches.
|
inline |
Returns true if this program will be run.
Definition at line 113 of file PipelineApplication.h.
References p_enabled.
Referenced by Isis::Pipeline::FinalOutput(), Next(), Isis::operator<<(), OutputBranches(), Previous(), and PreviousOutputer().
|
private |
The method, given a string, finds the index of a branch.
name | Branch name |
input | True if input branch, false if output branch |
Definition at line 759 of file PipelineApplication.cpp.
References Isis::IException::Programmer.
|
private |
Returns true if a future application creates output.
Definition at line 713 of file PipelineApplication.cpp.
|
private |
This gets the input parameter for the specified branch.
branch | Branch the input parameter is for |
Definition at line 733 of file PipelineApplication.cpp.
References Isis::IException::Programmer.
vector< QString > & Isis::PipelineApplication::GetOutputs | ( | ) |
This returns this application's output files. Only valid after BuildParamString is called.
Definition at line 861 of file PipelineApplication.cpp.
Referenced by BuildParamString(), and CalculateInputFile().
|
inlineprivate |
Returns the pipeline.
Definition at line 250 of file PipelineApplication.h.
References p_pipeline.
Referenced by PipelineApplication().
|
private |
This method is used to calculate the value for CustomParameterValue::LastOutput.
skipOne | Skip the very last output; this is used to skip the output of the current run |
Definition at line 825 of file PipelineApplication.cpp.
|
inline |
Get the branches this program expects as input.
Definition at line 86 of file PipelineApplication.h.
References p_inBranches.
|
private |
Returns true if this is the last application with output.
Definition at line 694 of file PipelineApplication.cpp.
|
inlineprivate |
Returns true if this application does merge branches (multiple input branches, one output)
Definition at line 261 of file PipelineApplication.h.
References p_inBranches, and p_outBranches.
|
inline |
Get the name of this pipeline application.
Definition at line 78 of file PipelineApplication.h.
References p_name.
Referenced by BuildParamString(), and Isis::operator<<().
|
inline |
|
inline |
Get the branches this program has as output.
Definition at line 90 of file PipelineApplication.h.
References Enabled(), OutputBranches(), p_inBranches, p_outBranches, and Previous().
Referenced by BuildParamString(), Isis::Pipeline::FinalOutput(), and OutputBranches().
|
inline |
This returns this application's output file name's extension.
Definition at line 140 of file PipelineApplication.h.
References OutputExtension(), p_outputExtension, and Previous().
Referenced by Isis::Pipeline::FinalOutput(), and OutputExtension().
|
inline |
This returns this application's output name modifier.
Definition at line 136 of file PipelineApplication.h.
References OutputNameModifier(), p_outputMod, and Previous().
Referenced by Isis::Pipeline::FinalOutput(), and OutputNameModifier().
|
inline |
Get the parameters for running this program; one element in the vector per run.
Definition at line 82 of file PipelineApplication.h.
References p_paramString.
Referenced by Isis::operator<<().
|
inline |
This returns the last enabled pipeline application or null.
Definition at line 177 of file PipelineApplication.h.
References Enabled(), p_previous, and Previous().
Referenced by BuildParamString(), CalculateInputFile(), Isis::Pipeline::FinalOutput(), OutputBranches(), OutputExtension(), OutputNameModifier(), Previous(), and PreviousOutputer().
|
inline |
This returns the previous enabled pipeline application that makes output or null.
Definition at line 184 of file PipelineApplication.h.
References Enabled(), p_output, p_previous, and Previous().
|
inline |
Set the continue flag status.
pbFlag | - true/false |
Definition at line 231 of file PipelineApplication.h.
References p_continue.
void Isis::PipelineApplication::SetInputParameter | ( | const QString & | inputParamName, |
bool | supportsVirtualBands | ||
) |
Set the input parameter for this application and whether or not this application supports the virtual bands functionality.
It supports the virtual bands functionality if the input is an Isis cube.
inputParamName | Name of the input parameter, typically "FROM" |
supportsVirtualBands | True if this application supports virtual bands |
Definition at line 79 of file PipelineApplication.cpp.
void Isis::PipelineApplication::SetInputParameter | ( | const QString & | inputParamName, |
CustomParameterValue | value, | ||
bool | supportsVirtualBands | ||
) |
Set the input parameter for this application and whether or not this application supports the virtual bands functionality.
It supports the virtual bands functionality if the input is an Isis cube.
inputParamName | Name of the input parameter, typically "FROM" |
value | Custom parameter value; Recommended to use an alternate SetInputParameter instead of specifying LastOutput |
supportsVirtualBands | True if this application supports virtual bands |
Definition at line 96 of file PipelineApplication.cpp.
|
inline |
Link to the next application in the pipeline.
next | The next pipeline application |
Definition at line 153 of file PipelineApplication.h.
References p_next.
Referenced by Isis::Pipeline::AddToPipeline().
void Isis::PipelineApplication::SetOutputParameter | ( | const QString & | branch, |
const QString & | outputParamName, | ||
const QString & | outNameModifier, | ||
const QString & | outFileExtension | ||
) |
Set the output parameter for a branch of this application and it's naming convention.
This is meant for an application that splits the input into two output files via two output parameters.
branch | Branch this output parameter applies to |
outputParamName | Name of the output parameter |
outNameModifier | Modifier to add to the cube name, such as "lev1" |
outFileExtension | Extension of the output file (usually "cub" for cube) |
Definition at line 122 of file PipelineApplication.cpp.
void Isis::PipelineApplication::SetOutputParameter | ( | const QString & | outputParamName, |
const QString & | outNameModifier, | ||
const QString & | outFileExtension = "cub" |
||
) |
Set the output parameter for this application and it's naming convention.
outputParamName | Name of the output parameter |
outNameModifier | Modifier to add to the cube name, such as "lev1" |
outFileExtension | Extension of the output file (usually "cub" for cube) |
Definition at line 137 of file PipelineApplication.cpp.
|
inline |
Link to the previous application in the pipeline.
prev | The previous pipeline application |
Definition at line 163 of file PipelineApplication.h.
References p_previous.
Referenced by Isis::Pipeline::AddToPipeline().
void Isis::PipelineApplication::SetVirtualBands | ( | std::vector< QString > | bands | ) |
Set the virtual bands that this application is to apply.
Empty for none.
bands | The virtual bands string, excluding the "+". For example, "2,4-5,8" |
Definition at line 856 of file PipelineApplication.cpp.
|
inlineprivate |
String comparison helper, returns true if from starts with compare bool.
from | Longer string ("abcdef") |
compare | String to compare against ("abc") |
Definition at line 273 of file PipelineApplication.h.
bool Isis::PipelineApplication::SupportsVirtualBands | ( | ) |
Returns true if virtual bands are supported.
Definition at line 844 of file PipelineApplication.cpp.
vector< QString > Isis::PipelineApplication::TemporaryFiles | ( | ) |
This method returns a list of the temporary files generated by this program.
Definition at line 799 of file PipelineApplication.cpp.
Referenced by Isis::operator<<().
|
private |
Continue the pipeline execution even if an error is encountered by this app.
Definition at line 289 of file PipelineApplication.h.
Referenced by Continue(), and SetContinue().
|
private |
Branch enabled/disabled.
Definition at line 298 of file PipelineApplication.h.
Referenced by BranchEnabled(), and EnableBranch().
|
private |
This application enabled?
Definition at line 290 of file PipelineApplication.h.
|
private |
Input branches.
Definition at line 296 of file PipelineApplication.h.
Referenced by Branches(), EnableBranch(), InputBranches(), Merges(), and OutputBranches().
|
private |
Input parameters.
Definition at line 305 of file PipelineApplication.h.
|
private |
Name of this application.
Definition at line 292 of file PipelineApplication.h.
Referenced by Name().
|
private |
Next pipeline application.
Definition at line 309 of file PipelineApplication.h.
|
private |
Output branches.
Definition at line 297 of file PipelineApplication.h.
Referenced by Branches(), Merges(), and OutputBranches().
|
private |
Output parameters.
Definition at line 300 of file PipelineApplication.h.
Referenced by PreviousOutputer().
|
private |
Output file name extension.
Definition at line 302 of file PipelineApplication.h.
Referenced by OutputExtension().
|
private |
Output file name modifier.
Definition at line 301 of file PipelineApplication.h.
Referenced by OutputNameModifier().
|
private |
Actual output files.
Definition at line 293 of file PipelineApplication.h.
|
private |
Regular parameters.
Definition at line 306 of file PipelineApplication.h.
|
private |
Built parameter strings.
Definition at line 295 of file PipelineApplication.h.
Referenced by ParamString().
|
private |
|
private |
Previous pipeline application.
Definition at line 308 of file PipelineApplication.h.
Referenced by Previous(), PreviousOutputer(), and SetPrevious().
|
private |
This application supports virtual bands?
Definition at line 291 of file PipelineApplication.h.
|
private |
Actial temporary files.
Definition at line 294 of file PipelineApplication.h.
|
private |
Virtual bands string to add (empty if none)
Definition at line 303 of file PipelineApplication.h.