ROSE 0.11.145.192
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();
}
RAII sub-task progress.
Definition Progress.h:445
Progress::Ptr progress() const
Progress object being used.
Definition Progress.h:481
A single progress report.
Definition Progress.h:181

Definition at line 445 of file Progress.h.

#include <Rose/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.
 
void cancel ()
 Cancel all cleanup operations.
 

Constructor & Destructor Documentation

◆ ProgressTask() [1/2]

Rose::ProgressTask::ProgressTask ( const Progress::Ptr progress,
const std::string &  name,
double  afterCompletion = NAN 
)
inline

Prepare existing progress object for subtask.

Definition at line 451 of file Progress.h.

References Rose::Progress::Report::completion.

◆ ProgressTask() [2/2]

Rose::ProgressTask::ProgressTask ( const std::string &  name,
double  afterCompletion = NAN 
)
inline

Create progress object for subtask.

Definition at line 461 of file Progress.h.

References Rose::Progress::Report::completion.

◆ ~ProgressTask()

Rose::ProgressTask::~ProgressTask ( )
inline

Clean up subtask progress.

Definition at line 469 of file Progress.h.

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 481 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 489 of file Progress.h.


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