![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/NestedProgress.h>
Wrapper class to provide the Progress interface, ensure certain invariants for created tasks and/or optionally forward the progress information to an existing Progress. More...
Inheritance diagram for NestedProgress:Wrapper class to provide the Progress interface, ensure certain invariants for created tasks and/or optionally forward the progress information to an existing Progress.
The main use case of this class if you have a consumer accepting a Progress and want to achieve one of the following things:
ThreadSafe flag. Public Types | |
| enum | TaskMode { Default = 0 , ThreadSafe = 1 << 0 , Hidden = 1 << 1 } |
| Enumeration of possible invariants that should be ensured by NestedProgress. More... | |
Public Member Functions | |
| NestedProgress (Progress *parent=nullptr, Flags< TaskMode > taskFlags=TaskMode::Default) | |
| Creates a new NestedProgress instance. | |
| void | setParentProgress (Progress *parent) |
| Updates the parent Progress instance to which progress updates should be forwarded to. | |
| void | cancelAllTasks () |
| Will cancel all tasks that were spawned from this NestedProgress instance. | |
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. | |
Public Attributes | |
| ProtectedSignal< Task * > | signalTaskAdded |
| Signal emitted by the default implementation of NestedProgress::onTaskAdded(). | |
| ProtectedSignal< const Task * > | signalTaskUpdated |
| Signal emitted by the default implementation of NestedProgress::onTaskUpdated(). | |
Protected Member Functions | |
| 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. | |
Protected Attributes | |
| Progress * | m_parent |
| const Flags< TaskMode > | m_taskFlags |
| std::unique_ptr< std::mutex > | m_mutex |
| std::unique_ptr< Task > | m_parentThreadSafetyGuard |
| std::vector< Task * > | m_tasks |
| enum TaskMode |
Enumeration of possible invariants that should be ensured by NestedProgress.
|
explicit |
Creates a new NestedProgress instance.
| parent | Optional parent progress instance to which progress updates should be forwarded to. |
| taskFlags | Optional set of invariants that tasks created by this instance should adhere to. |
|
overrideprotectedvirtual |
Function is called whenever a new Task has been created.
Implements Progress.
|
overrideprotectedvirtual |
Function is called whenever the state of a Task has changed and the reporter should update its UI.
Implements Progress.
Reimplemented in WatershedComputer.
|
overrideprotectedvirtual |
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.
|
overrideprotectedvirtual |
Function is called whenever a Task is about to be destroyed and its pointer will become invalid.
Implements Progress.
| ProtectedSignal<Task*> signalTaskAdded |
Signal emitted by the default implementation of NestedProgress::onTaskAdded().
Subscription to this signal is useful in case you want to customize progress tasks without inheriting from NestedProgress.
| ProtectedSignal<const Task*> signalTaskUpdated |
Signal emitted by the default implementation of NestedProgress::onTaskUpdated().
Subscription to this signal is useful in case you want to perform custom action on progress updates without inheriting from NestedProgress.