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.
2008-09-25 Added features: Application identifiers other than the application names, branched original input, branching from branches, partial branch merging (discontinuing branches*)
2008-09-26 Steven Lambright Fixed introduced bug where input data was not being found when no previous programs in the pipeline generated output (needed to go back to original input).
2008-09-26 Steven Lambright Changed CalculateOutputFile(...) to work in more cases. Pipeline::FinalOutput is relied upon more heavily now to do the right thing.
2010-12-20 Sharmila Prasad - Added the ability to enable/disable a branch.
2011-02-09 Sharmila Prasad - Added option continue to proceed with execution of the next application in the pipeline if the current encounters an exception.
Definition at line 62 of file PipelineApplication.h.
This is used to set custom values that must be calculated on the fly.
Definition at line 82 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 74 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 19 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 49 of file PipelineApplication.cpp.
References GetPipeline().
|
inline |
This is the destructor.
Definition at line 68 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 157 of file PipelineApplication.cpp.
References _FILEINFO_, and 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 238 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 264 of file PipelineApplication.cpp.
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 204 of file PipelineApplication.cpp.
References IsisAml::GetAsString(), Isis::Application::GetUserInterface(), and IsisAml::WasEntered().
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 222 of file PipelineApplication.cpp.
References IsisAml::GetAsString(), Isis::Application::GetUserInterface(), and IsisAml::WasEntered().
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 276 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 289 of file PipelineApplication.cpp.
|
inline |
Check whether a branch is enabled given branch index.
branch | - index into the branch |
Definition at line 234 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 271 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 302 of file PipelineApplication.cpp.
References _FILEINFO_, Isis::FileName::baseName(), BranchEnabled(), GetOutputs(), Isis::IsSpecial(), Isis::PipelineParameter::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 513 of file PipelineApplication.cpp.
References _FILEINFO_, 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 584 of file PipelineApplication.cpp.
References Isis::FileName::baseName(), and Isis::FileName::path().
|
inline |
Get the continue flag status.
Definition at line 258 of file PipelineApplication.h.
References p_continue.
|
inline |
This method disables this program, causing it to be ignored.
Definition at line 124 of file PipelineApplication.h.
References p_enabled.
|
inline |
This method enables this program to be run.
Definition at line 119 of file PipelineApplication.h.
References p_enabled.
|
inline |
Enable/Disable Branch given the branch name.
branch | - branch name |
flag | - true/false |
Definition at line 218 of file PipelineApplication.h.
References p_enableBranch, and p_inBranches.
|
inline |
Returns true if this program will be run.
Definition at line 129 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 753 of file PipelineApplication.cpp.
References _FILEINFO_, and Isis::IException::Programmer.
|
private |
Returns true if a future application creates output.
Definition at line 707 of file PipelineApplication.cpp.
|
private |
This gets the input parameter for the specified branch.
branch | Branch the input parameter is for |
Definition at line 727 of file PipelineApplication.cpp.
References _FILEINFO_, and Isis::IException::Programmer.
vector< QString > & Isis::PipelineApplication::GetOutputs | ( | ) |
This returns this application's output files. Only valid after BuildParamString is called.
Definition at line 855 of file PipelineApplication.cpp.
Referenced by BuildParamString(), and CalculateInputFile().
|
inlineprivate |
Returns the pipeline.
Definition at line 266 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 819 of file PipelineApplication.cpp.
|
inline |
Get the branches this program expects as input.
Definition at line 102 of file PipelineApplication.h.
References p_inBranches.
|
private |
Returns true if this is the last application with output.
Definition at line 688 of file PipelineApplication.cpp.
|
inlineprivate |
Returns true if this application does merge branches (multiple input branches, one output)
Definition at line 277 of file PipelineApplication.h.
References p_inBranches, and p_outBranches.
|
inline |
Get the name of this pipeline application.
Definition at line 94 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 106 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 156 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 152 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 98 of file PipelineApplication.h.
References p_paramString.
Referenced by Isis::operator<<().
|
inline |
This returns the last enabled pipeline application or null.
Definition at line 193 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 200 of file PipelineApplication.h.
References Enabled(), p_output, p_previous, and Previous().
|
inline |
Set the continue flag status.
pbFlag | - true/false |
Definition at line 247 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 3 cube.
inputParamName | Name of the input parameter, typically "FROM" |
supportsVirtualBands | True if this application supports virtual bands |
Definition at line 73 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 3 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 90 of file PipelineApplication.cpp.
|
inline |
Link to the next application in the pipeline.
next | The next pipeline application |
Definition at line 169 of file PipelineApplication.h.
References p_next.
Referenced by Isis::Pipeline::AddToPipeline().
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 131 of file PipelineApplication.cpp.
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 116 of file PipelineApplication.cpp.
|
inline |
Link to the previous application in the pipeline.
prev | The previous pipeline application |
Definition at line 179 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 850 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 289 of file PipelineApplication.h.
bool Isis::PipelineApplication::SupportsVirtualBands | ( | ) |
Returns true if virtual bands are supported.
Definition at line 838 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 793 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 305 of file PipelineApplication.h.
Referenced by Continue(), and SetContinue().
|
private |
Branch enabled/disabled.
Definition at line 314 of file PipelineApplication.h.
Referenced by BranchEnabled(), and EnableBranch().
|
private |
This application enabled?
Definition at line 306 of file PipelineApplication.h.
|
private |
Input branches.
Definition at line 312 of file PipelineApplication.h.
Referenced by Branches(), EnableBranch(), InputBranches(), Merges(), and OutputBranches().
|
private |
Input parameters.
Definition at line 321 of file PipelineApplication.h.
|
private |
Name of this application.
Definition at line 308 of file PipelineApplication.h.
Referenced by Name().
|
private |
Next pipeline application.
Definition at line 325 of file PipelineApplication.h.
|
private |
Output branches.
Definition at line 313 of file PipelineApplication.h.
Referenced by Branches(), Merges(), and OutputBranches().
|
private |
Output parameters.
Definition at line 316 of file PipelineApplication.h.
Referenced by PreviousOutputer().
|
private |
Output file name extension.
Definition at line 318 of file PipelineApplication.h.
Referenced by OutputExtension().
|
private |
Output file name modifier.
Definition at line 317 of file PipelineApplication.h.
Referenced by OutputNameModifier().
|
private |
Actual output files.
Definition at line 309 of file PipelineApplication.h.
|
private |
Regular parameters.
Definition at line 322 of file PipelineApplication.h.
|
private |
Built parameter strings.
Definition at line 311 of file PipelineApplication.h.
Referenced by ParamString().
|
private |
|
private |
Previous pipeline application.
Definition at line 324 of file PipelineApplication.h.
Referenced by Previous(), PreviousOutputer(), and SetPrevious().
|
private |
This application supports virtual bands?
Definition at line 307 of file PipelineApplication.h.
|
private |
Actial temporary files.
Definition at line 310 of file PipelineApplication.h.
|
private |
Virtual bands string to add (empty if none)
Definition at line 319 of file PipelineApplication.h.