Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::API::Progress Class Referencefinal

Helper class for reporting progress from algorithms. More...

#include <Progress.h>

Inheritance diagram for Mantid::API::Progress:
Mantid::Kernel::ProgressBase

Public Member Functions

void doReport (const std::string &msg="") override
 Actually do the reporting, without changing the loop counter.
 
bool hasCancellationBeenRequested () const override
 
 Progress ()
 Default constructor.
 
 Progress (Algorithm *alg, double start, double end, int numSteps)
 Creates a Progress instance.
 
 Progress (Algorithm *alg, double start, double end, int64_t numSteps)
 Creates a Progress instance.
 
 Progress (Algorithm *alg, double start, double end, size_t numSteps)
 Creates a Progress instance.
 
- Public Member Functions inherited from Mantid::Kernel::ProgressBase
double getEstimatedTime () const
 Returns the estimated number of seconds until the algorithm completes.
 
ProgressBaseoperator= (const ProgressBase &rhs)
 
 ProgressBase ()
 Default constructor.
 
 ProgressBase (const ProgressBase &source)
 Copy constructor that builds a new ProgressBase object.
 
 ProgressBase (double start, double end, int64_t numSteps)
 Creates a ProgressBase instance.
 
void report ()
 Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
 
void report (const std::string &msg)
 Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
 
void report (int64_t i, const std::string &msg="")
 Sends the progress notification on behalf of its algorithm.
 
void reportIncrement (int inc, const std::string &msg="")
 Sends the progress notification and increment the loop counter by more than one.
 
void reportIncrement (size_t inc, const std::string &msg="")
 Sends the progress notification and increment the loop counter by more than one.
 
void resetNumSteps (int64_t nsteps, double start, double end)
 Change the number of steps between start/end.
 
void setNotifyStep (double notifyStepPct)
 Override the frequency at which notifications are sent out.
 
void setNumSteps (int64_t nsteps)
 Change the number of steps between start/end.
 
virtual ~ProgressBase ()
 Destructor.
 

Private Attributes

Algorithm *const m_alg
 Owning algorithm.
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Kernel::ProgressBase
double m_end
 Ending progress.
 
std::atomic< int64_t > m_i
 Loop counter.
 
int64_t m_ifirst
 Loop counter initial value.
 
std::atomic< int64_t > m_last_reported
 Last loop counter value the was a peport.
 
int64_t m_notifyStep
 Frequency of sending the notification (every m_step times)
 
double m_notifyStepPct
 Frequency of sending the notification (as a min percentage step, e.g.
 
int m_notifyStepPrecision
 Digits of precision in the reporting.
 
int64_t m_numSteps
 Loop counter upper bound.
 
double m_start
 Starting progress.
 
double m_step
 Progress increment at each loop.
 
std::unique_ptr< Kernel::Timerm_timeElapsed
 Timer that is started when the progress bar is constructed.
 

Detailed Description

Helper class for reporting progress from algorithms.

Author
Roman Tolchenov, Tessella Support Services plc
Date
06/02/2009

Definition at line 25 of file Progress.h.

Constructor & Destructor Documentation

◆ Progress() [1/4]

Mantid::API::Progress::Progress ( )

Default constructor.

Definition at line 28 of file Progress.cpp.

◆ Progress() [2/4]

Mantid::API::Progress::Progress ( Algorithm alg,
double  start,
double  end,
int  numSteps 
)

Creates a Progress instance.

Parameters
alg:: Algorithm reporting its progress
start:: Starting progress
end:: Ending progress
numSteps:: Number of times report(...) method will be called.

Definition at line 36 of file Progress.cpp.

◆ Progress() [3/4]

Mantid::API::Progress::Progress ( Algorithm alg,
double  start,
double  end,
int64_t  numSteps 
)

Creates a Progress instance.

Parameters
alg:: Algorithm reporting its progress
start:: Starting progress
end:: Ending progress
numSteps:: Number of times report(...) method will be called.

Definition at line 47 of file Progress.cpp.

◆ Progress() [4/4]

Mantid::API::Progress::Progress ( Algorithm alg,
double  start,
double  end,
size_t  numSteps 
)

Creates a Progress instance.

Parameters
alg:: Algorithm reporting its progress
start:: Starting progress
end:: Ending progress
numSteps:: Number of times report(...) method will be called.

Definition at line 58 of file Progress.cpp.

Member Function Documentation

◆ doReport()

void Mantid::API::Progress::doReport ( const std::string &  msg = "")
overridevirtual

◆ hasCancellationBeenRequested()

bool Mantid::API::Progress::hasCancellationBeenRequested ( ) const
overridevirtual
Returns
true if an algorithm has been set & it has requested to be cancelled

Reimplemented from Mantid::Kernel::ProgressBase.

Definition at line 85 of file Progress.cpp.

References Mantid::API::Algorithm::getCancel(), and m_alg.

Referenced by Mantid::DataHandling::SaveParameterFile::exec().

Member Data Documentation

◆ m_alg

Algorithm* const Mantid::API::Progress::m_alg
private

Owning algorithm.

Definition at line 36 of file Progress.h.

Referenced by doReport(), and hasCancellationBeenRequested().


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