ROSE  0.11.145.0
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 438 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. More...
 
 ProgressTask (const std::string &name, double afterCompletion=NAN)
 Create progress object for subtask. More...
 
 ~ProgressTask ()
 Clean up subtask progress. More...
 
Progress::Ptr progress () const
 Progress object being used. More...
 
void cancel ()
 Cancel all cleanup operations. More...
 

Constructor & Destructor Documentation

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

Prepare existing progress object for subtask.

Definition at line 444 of file Progress.h.

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

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

Create progress object for subtask.

Definition at line 454 of file Progress.h.

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

Rose::ProgressTask::~ProgressTask ( )
inline

Clean up subtask progress.

Definition at line 462 of file Progress.h.

Member Function Documentation

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

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


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