ImFusion SDK 4.3
SubProgress Class Reference

#include <ImFusion/Base/SubProgress.h>

Wrapper class to report partial progress on an existing Task. More...

+ Inheritance diagram for SubProgress:

Detailed Description

Wrapper class to report partial progress on an existing Task.

This class provides a Progress interface that linearly maps to a given range of an existing Progress::Task. It can be used to merge the progress of multiple methods that are not aware of each other into one single progress report and use up its entire range. This is different to a NestedProgress as creating tasks on a SubProgress will not create a new task on the parent reporter (usually resulting in an additional progress bar) but reuse an existing task.

Progress::Task task(m_progress, 0, "Computing...");
// algo1 will report its progress using the first half of `task`'s progress bar
SubProgress subProgress1(&task, 0.0, 0.5);
algo1->compute(&subProgress1);
// algo1 will report its progress using the second half of `task`'s progress bar
SubProgress subProgress2(&task, 0.5, 1.0);
algo2->compute(&subProgress2);
Represents the progress/status report of an individual task hosted by a Progress.
Definition Progress.h:66
SubProgress(Progress::Task *parentTask, double startRatio, double endRatio, int resolution=100)
Create a new SubProgress instance where update reports are merged into the current step information o...
Note
Consumers of SubProgress can only add a single Task on it. If they add multiple tasks at the same time all tasks except for the first one are ignored.

Public Member Functions

 SubProgress (Progress::Task *parentTask, double startRatio, double endRatio, int resolution=100)
 Create a new SubProgress instance where update reports are merged into the current step information of the parent task.
 
bool forwardsDescription () const
 Returns the flag whether to forward the task description from the sub progress to the parent.
 
void setForwardDescription (bool value)
 Sets the flag whether to forward the task description from the sub progress to the parent.
 
void onTaskAdded (Task *task) override
 Function is called whenever a new Task has been created.
 
void onTaskUpdated (const Task *task) override
 Function is called whenever the state of a Task has changed and the reporter should update its UI.
 
bool onTaskRequestsThreadSafety (const Task *task) override
 Function is called by Task::requestThreadSafety() in order to check whether the parent reporter supports concurrent access.
 
void onTaskRemoved (const Task *task) override
 Function is called whenever a Task is about to be destroyed and its pointer will become invalid.
 
- Public Member Functions inherited from Progress
Task addTask (int numSteps, const std::string &description)
 Create a new progress report for an operation with the given number of steps.
 
Task addBusyIndicator (const std::string &description)
 Create a busy indicator for an operation but does not have a predefined number of steps.
 

Constructor & Destructor Documentation

◆ SubProgress()

SubProgress ( Progress::Task * parentTask,
double startRatio,
double endRatio,
int resolution = 100 )

Create a new SubProgress instance where update reports are merged into the current step information of the parent task.

Progress reports on this object will be mapped linearly to the range startRatio*resolution .. endRatio*resolution.

Member Function Documentation

◆ onTaskAdded()

void onTaskAdded ( Task * task)
overridevirtual

Function is called whenever a new Task has been created.

Implements Progress.

◆ onTaskUpdated()

void onTaskUpdated ( const Task * task)
overridevirtual

Function is called whenever the state of a Task has changed and the reporter should update its UI.

Implements Progress.

◆ onTaskRequestsThreadSafety()

bool onTaskRequestsThreadSafety ( const Task * task)
overridevirtual

Function is called by Task::requestThreadSafety() in order to check whether the parent reporter supports concurrent access.

Implementations are free to ignore this request and return false. Otherwise they must ensure that subsequent concurrent calls to any of the onTask...() callbacks are handled correctly without race conditions. Implementations are free to return to a unsynchronized implementation as soon as all multi-threaded tasks have been removed from the reporter.

Implements Progress.

◆ onTaskRemoved()

void onTaskRemoved ( const Task * task)
overridevirtual

Function is called whenever a Task is about to be destroyed and its pointer will become invalid.

Implements Progress.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close