ROSE  0.11.96.11
Public Member Functions | List of all members
Rose::ProgressTask Class Reference

Description

RAII sub-task progress.

Pushes a new context onto the specified progress reporting object in preparation for calling an analysis that does its own progress reporting.

Use this class like this. The completion ratios are arbitrary and we've assumed that do_something, inner both take roughly the same (large) amount of time.

void outerTask(const Progress::Report &progress) {
progress->update(Progress::Report(0.0));
do_something(); // after this, we're 1/3 done
{
ProgressTask t(progress, "inner", 0.67);
inner(progress); // progress reports named "outer.inner" going from [0..1]
}
progress->update(Progress::Report(0.67)); // optional since 0.67 was reported by destructor
do_something();
}

Definition at line 437 of file Progress.h.

#include <Progress.h>

Public Member Functions

 ProgressTask (const Progress::Ptr &progress, const std::string &name, double afterCompletion=NAN)
 Prepare existing progress object for subtask.
 
 ProgressTask (const std::string &name, double afterCompletion=NAN)
 Create progress object for subtask.
 
 ~ProgressTask ()
 Clean up subtask progress.
 
Progress::Ptr progress () const
 Progress object being used. More...
 
void cancel ()
 Cancel all cleanup operations. More...
 

Member Function Documentation

◆ progress()

Progress::Ptr Rose::ProgressTask::progress ( ) const
inline

Progress object being used.

This returns one of the following values:

  • If cancel has been called then return the null pointer.
  • If constructed with a progress object, return that object (possibly null).
  • Return the progress created by the constructor.

Definition at line 473 of file Progress.h.

◆ cancel()

void Rose::ProgressTask::cancel ( )
inline

Cancel all cleanup operations.

If called, then the destructor will do nothing other than possibly releasing a reference to the progress object supplied to or created by the constructor.

Definition at line 481 of file Progress.h.


The documentation for this class was generated from the following file:
Rose::ProgressTask::ProgressTask
ProgressTask(const Progress::Ptr &progress, const std::string &name, double afterCompletion=NAN)
Prepare existing progress object for subtask.
Definition: Progress.h:443
Rose::ProgressTask::progress
Progress::Ptr progress() const
Progress object being used.
Definition: Progress.h:473