A singleton class used to manage tasks progresses and their viewers. More...
#include <ProgressManager.h>
Public Types | |
| typedef ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > | LockRead |
| typedef ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > | LockWrite |
| typedef volatile ProgressManager | VolatileType |
Public Member Functions | |
| int | addTask (TaskProgress *tp) |
| Used in TaskProgress constructor, register this task generating a task id. More... | |
| int | addViewer (AbstractProgressViewer *apv) |
| Attach a progress viewer. More... | |
| void | cancelTask (int taskId) |
| Inform all viewers that a task was canceled. More... | |
| void | cancelTasks (unsigned int type) |
| Cancels the task with the given task type and inform all viewers that a task was canceled. More... | |
| void | clearAll () |
| Removes references for Viewers and tasks. More... | |
| void | removeTask (int taskId) |
| Used in TaskProgress destructor, remove task from singleton. More... | |
| void | removeViewer (int viewerId) |
| Dettach a progress viewer (AbstractProgressViewer destructor calls this method). More... | |
| void | setSuspendViewers (bool flag) |
| void | setTotalValues (int taskId) |
| Inform all viewers that a task set the total values. More... | |
| void | updateMessage (int taskId) |
| Inform all viewers that a task set the message. More... | |
| void | updateValue (int taskId) |
| Inform all viewers that a task set the current step. More... | |
Static Public Member Functions | |
| static ProgressManager & | getInstance () |
| It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
| int | generateTaskId () |
| Used to generate a new task id (use internal counter). More... | |
| int | generateViewerId () |
| Used to generate a new viewer id (use internal counter). More... | |
| ProgressManager () | |
| Default constructor. More... | |
| ~ProgressManager () | |
| Destructor. More... | |
Protected Attributes | |
| bool | m_suspendViewers |
| int | m_taskCounter |
| Counter used to generate a task id. More... | |
| std::map< int, TaskProgress * > | m_tasks |
| Container with tasks. More... | |
| int | m_viewerCounter |
| Counter used to generate a viewer id. More... | |
| std::map< int, AbstractProgressViewer * > | m_viewers |
| Container with viewers. More... | |
Friends | |
| class | te::common::Singleton< ProgressManager > |
A singleton class used to manage tasks progresses and their viewers.
This singleton is used to store all tasks created and their progress viewers. If one or more viewers is attached, all instances will be used to display the tasks progresses.
Definition at line 59 of file ProgressManager.h.
|
inherited |
Definition at line 205 of file ThreadingPolicies.h.
|
inherited |
Definition at line 206 of file ThreadingPolicies.h.
|
inherited |
Definition at line 204 of file ThreadingPolicies.h.
|
protected |
Default constructor.
Definition at line 200 of file ProgressManager.cpp.
|
protected |
| int te::common::ProgressManager::addTask | ( | TaskProgress * | tp | ) |
Used in TaskProgress constructor, register this task generating a task id.
| tp | TaskProgress instance |
Definition at line 61 of file ProgressManager.cpp.
References generateTaskId(), m_suspendViewers, m_tasks, and m_viewers.
Referenced by te::common::TaskProgress::TaskProgress().
| int te::common::ProgressManager::addViewer | ( | AbstractProgressViewer * | apv | ) |
Attach a progress viewer.
| apv | Progress viewer instance |
Definition at line 31 of file ProgressManager.cpp.
References generateViewerId(), and m_viewers.
Referenced by te::common::AbstractProgressViewer::AbstractProgressViewer(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::plugins::terramobile::GeoPackagePublisherDialog::onExportPushButtonClicked(), and te::qt::plugins::terramobile::GeoPackagePublisherDialog::onImportPushButtonClicked().
| void te::common::ProgressManager::cancelTask | ( | int | taskId | ) |
Inform all viewers that a task was canceled.
| taskId | Task identifier. |
Definition at line 106 of file ProgressManager.cpp.
References m_suspendViewers, m_tasks, and m_viewers.
Referenced by te::common::TaskProgress::cancel().
| void te::common::ProgressManager::cancelTasks | ( | unsigned int | type | ) |
Cancels the task with the given task type and inform all viewers that a task was canceled.
| type | The task type. |
Definition at line 127 of file ProgressManager.cpp.
References m_suspendViewers, and m_tasks.
Referenced by MainWindow::onStopAllTriggered(), and te::qt::af::BaseApplication::onStopDrawTriggered().
| void te::common::ProgressManager::clearAll | ( | ) |
Removes references for Viewers and tasks.
Definition at line 194 of file ProgressManager.cpp.
References m_tasks, and m_viewers.
Referenced by ~ProgressManager(), and TerraView::~TerraView().
|
protected |
Used to generate a new task id (use internal counter).
Definition at line 217 of file ProgressManager.cpp.
References m_taskCounter.
Referenced by addTask().
|
protected |
Used to generate a new viewer id (use internal counter).
Definition at line 212 of file ProgressManager.cpp.
References m_viewerCounter.
Referenced by addViewer().
|
staticinherited |
It returns a reference to the singleton instance.
Referenced by te::common::AbstractProgressViewer::AbstractProgressViewer(), te::common::TaskProgress::cancel(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::plugins::terramobile::GeoPackagePublisherDialog::onExportPushButtonClicked(), te::qt::plugins::terramobile::GeoPackagePublisherDialog::onImportPushButtonClicked(), MainWindow::onStopAllTriggered(), te::qt::af::BaseApplication::onStopDrawTriggered(), te::common::TaskProgress::setCurrentStep(), te::common::TaskProgress::setMessage(), te::common::TaskProgress::setTotalSteps(), te::common::TaskProgress::TaskProgress(), te::common::AbstractProgressViewer::~AbstractProgressViewer(), te::common::TaskProgress::~TaskProgress(), and TerraView::~TerraView().
| void te::common::ProgressManager::removeTask | ( | int | taskId | ) |
Used in TaskProgress destructor, remove task from singleton.
| taskId | Task identifier. |
Definition at line 83 of file ProgressManager.cpp.
References m_suspendViewers, m_tasks, and m_viewers.
Referenced by te::common::TaskProgress::~TaskProgress().
| void te::common::ProgressManager::removeViewer | ( | int | viewerId | ) |
Dettach a progress viewer (AbstractProgressViewer destructor calls this method).
| viewerId | Progress viewer identifier |
Definition at line 51 of file ProgressManager.cpp.
References m_viewers.
Referenced by te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::plugins::terramobile::GeoPackagePublisherDialog::onExportPushButtonClicked(), te::qt::plugins::terramobile::GeoPackagePublisherDialog::onImportPushButtonClicked(), and te::common::AbstractProgressViewer::~AbstractProgressViewer().
|
inline |
Definition at line 145 of file ProgressManager.h.
| void te::common::ProgressManager::setTotalValues | ( | int | taskId | ) |
Inform all viewers that a task set the total values.
| taskId | Task identifier. |
Definition at line 149 of file ProgressManager.cpp.
References m_suspendViewers, and m_viewers.
Referenced by te::common::TaskProgress::setTotalSteps().
| void te::common::ProgressManager::updateMessage | ( | int | taskId | ) |
Inform all viewers that a task set the message.
| taskId | Task identifier. |
Definition at line 179 of file ProgressManager.cpp.
References m_suspendViewers, and m_viewers.
Referenced by te::common::TaskProgress::setMessage().
| void te::common::ProgressManager::updateValue | ( | int | taskId | ) |
Inform all viewers that a task set the current step.
| taskId | Task identifier. |
Definition at line 164 of file ProgressManager.cpp.
References m_suspendViewers, and m_viewers.
Referenced by te::common::TaskProgress::setCurrentStep().
|
friend |
Definition at line 65 of file ProgressManager.h.
|
protected |
Definition at line 176 of file ProgressManager.h.
Referenced by addTask(), cancelTask(), cancelTasks(), removeTask(), setTotalValues(), updateMessage(), and updateValue().
|
protected |
Counter used to generate a task id.
Definition at line 171 of file ProgressManager.h.
Referenced by generateTaskId().
|
protected |
Container with tasks.
Definition at line 173 of file ProgressManager.h.
Referenced by addTask(), cancelTask(), cancelTasks(), clearAll(), and removeTask().
|
protected |
Counter used to generate a viewer id.
Definition at line 172 of file ProgressManager.h.
Referenced by generateViewerId().
|
protected |
Container with viewers.
Definition at line 174 of file ProgressManager.h.
Referenced by addTask(), addViewer(), cancelTask(), clearAll(), removeTask(), removeViewer(), setTotalValues(), updateMessage(), and updateValue().