USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::Progress Class Reference
[Application Interface]

#include <Progress.h>

Collaboration diagram for Isis::Progress:

Collaboration graph
[legend]
List of all members.

Detailed Description

Program progress reporter.

This class is used to output the percent completion for programs in either the command line mode or the graphical user interface. Generally, this object is created within a Process derived class. Therefore you should only use this object if you are developing such a class.

Author:
2002-05-22 Jeff Anderson

For internal use only.

History:
2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...
History:
2004-02-29 Jeff Anderson - Added ability to send progress status to the parent process
History:
2005-02-11 Elizabeth Ribelin - Modified file to support Doxygen documentation
History:
2005-10-03 Elizabeth Miller - Changed
Todo:
2005-02-11 Jeff Anderson - add coded and implementation example to class documentation

Definition at line 53 of file Progress.h.

Public Member Functions

 Progress ()
 Constructs a Progress object.
 ~Progress ()
 Destroys the Progress object.
void SetText (const std::string &text)
 Changes the value of the text string reported just before 0% processed.
std::string Text () const
 Returns the text to output.
void SetMaximumSteps (const int steps)
 This sets the maximum number of steps in the process.
void AddSteps (const int steps)
 If the initial step size was a guess, it can be modified using this method.
void CheckStatus ()
 Checks and updates the status.

Private Attributes

std::string p_text
 Text string to output at the initial call to CheckStatus (0% processed).
int p_maximumSteps
 Number of steps in your processing sequence.
int p_currentStep
 The current step in the processing sequence.
int p_currentPercent
 The current percent we are checking against.
int p_percentIncrement
 How much to increment the currentPercent by.
bool p_printPercent


Constructor & Destructor Documentation

Isis::Progress::Progress (  ) 

Constructs a Progress object.

Exceptions:
Isis::iException::User 

Definition at line 38 of file Progress.cpp.

References _FILEINFO_, Isis::PvlObject::FindGroup(), Isis::iException::Message(), p_currentPercent, p_currentStep, p_maximumSteps, p_percentIncrement, p_printPercent, p_text, Isis::Preference::Preferences(), and Isis::iString::UpCase().

Isis::Progress::~Progress (  ) 

Destroys the Progress object.

Definition at line 65 of file Progress.cpp.


Member Function Documentation

void Isis::Progress::AddSteps ( const int  steps  ) 

If the initial step size was a guess, it can be modified using this method.

For example, if you SetMaximumSteps(11) then call AddSteps(1) then the new MaximumSteps is 12. The progress bar will not go backwards (it will not drop from 10% to 5%). "steps" can be negative to remove steps.

Parameters:
steps Amount to adjust the MaximumSteps by

Definition at line 177 of file Progress.cpp.

References _FILEINFO_, Isis::iException::Message(), p_currentStep, and p_maximumSteps.

Referenced by Isis::ImageOverlapSet::FindAllOverlaps(), and Isis::OverlapStatistics::OverlapStatistics().

void Isis::Progress::CheckStatus (  ) 

Checks and updates the status.

The first time this is invoked, it outputs the text from SetText and 0% processed. It should then be invoked for each step, for example, a step could be considered processing a line for NL lines in the image. If you do not call this enough times you will not reached 100% processed.

Exceptions:
Isis::iException::Programmer Step exceeds maximumSteps

Definition at line 121 of file Progress.cpp.

References _FILEINFO_, Isis::iApp, Isis::iException::Message(), p_currentPercent, p_currentStep, p_maximumSteps, p_percentIncrement, p_printPercent, p_text, Isis::Application::ProcessGuiEvents(), and Isis::Application::UpdateProgress().

Referenced by Isis::ImageOverlapSet::FindAllOverlaps(), Isis::Cube::Histogram(), Isis::Histogram::InitializeFromCube(), Isis::ProcessExport::InitProcess(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ControlNet::ReadControl(), Isis::ControlNet::SetImages(), Isis::ProcessRubberSheet::StartProcess(), Isis::ProcessMosaic::StartProcess(), Isis::ProcessExport::StartProcess(), Isis::ProcessByQuickFilter::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBoxcar::StartProcess(), Isis::ProcessExport::StartProcessBIL(), Isis::ProcessExport::StartProcessBIP(), Isis::ProcessExport::StartProcessBSQ(), and Isis::Cube::Statistics().

void Isis::Progress::SetMaximumSteps ( const int  steps  ) 

This sets the maximum number of steps in the process.

Whenever this is invoked it also resets the counters to their initial states. This allows for programs which have multiple steps.

Parameters:
steps Maximum number of steps
Exceptions:
Isis::iException::Programmer Invalid value for step (must be >0)

Definition at line 101 of file Progress.cpp.

References _FILEINFO_, Isis::iException::Message(), p_currentPercent, p_currentStep, and p_maximumSteps.

Referenced by Isis::ImageOverlapSet::FindAllOverlaps(), Isis::Cube::Histogram(), Isis::Histogram::InitializeFromCube(), Isis::ProcessExport::InitProcess(), Isis::OverlapStatistics::OverlapStatistics(), Isis::ProcessImport::ProcessBil(), Isis::ProcessImport::ProcessBip(), Isis::ProcessImport::ProcessBsq(), Isis::ControlNet::ReadControl(), Isis::ControlNet::SetImages(), Isis::ProcessRubberSheet::StartProcess(), Isis::ProcessMosaic::StartProcess(), Isis::ProcessByQuickFilter::StartProcess(), Isis::ProcessByBrick::StartProcess(), Isis::ProcessByBoxcar::StartProcess(), and Isis::Cube::Statistics().

void Isis::Progress::SetText ( const std::string &  text  ) 

Changes the value of the text string reported just before 0% processed.

This text is only output under the following condition. After SetMaximumSteps is called, the first call to CheckStatus will immediately output the text. By default this is set to "Working".

Parameters:
text Text to output.

Definition at line 76 of file Progress.cpp.

References p_text.

Referenced by Isis::ImageOverlapSet::FindAllOverlaps(), Isis::Cube::Histogram(), Isis::Histogram::InitializeFromCube(), Isis::OverlapStatistics::OverlapStatistics(), Isis::Process::Process(), Isis::ProcessExport::ProcessExport(), Isis::ProcessImport::ProcessImport(), Isis::ControlNet::ReadControl(), Isis::ControlNet::SetImages(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessMapMosaic::StartProcess(), and Isis::Cube::Statistics().

string Isis::Progress::Text (  )  const

Returns the text to output.

Generally, this in not needed except rare circumstances where an application has multiple steps and the text string needs to be saved and restored. For an example, see the Histogram method in the CubeInfo class.

Returns:
string

Definition at line 88 of file Progress.cpp.

References p_text.

Referenced by Isis::Histogram::InitializeFromCube().


Member Data Documentation

int Isis::Progress::p_currentPercent [private]

The current percent we are checking against.

Once this percentage is exceeded we report that percentage is completed and increase this value by the increment.

Definition at line 63 of file Progress.h.

Referenced by CheckStatus(), Progress(), and SetMaximumSteps().

int Isis::Progress::p_currentStep [private]

The current step in the processing sequence.

This is incremented by one everytime CheckStatus is called.

Definition at line 60 of file Progress.h.

Referenced by AddSteps(), CheckStatus(), Progress(), and SetMaximumSteps().

int Isis::Progress::p_maximumSteps [private]

Number of steps in your processing sequence.

For example, if there are 20 lines in an cube. This will be 20.

Definition at line 57 of file Progress.h.

Referenced by AddSteps(), CheckStatus(), Progress(), and SetMaximumSteps().

int Isis::Progress::p_percentIncrement [private]

How much to increment the currentPercent by.

It should only be 1,2, 5, or 10.

Definition at line 67 of file Progress.h.

Referenced by CheckStatus(), and Progress().

std::string Isis::Progress::p_text [private]

Text string to output at the initial call to CheckStatus (0% processed).

Definition at line 55 of file Progress.h.

Referenced by CheckStatus(), Progress(), SetText(), and Text().


The documentation for this class was generated from the following files: