All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::common::ProgressManager Class Reference

A singleton class used to manage tasks progresses and their viewers. More...

#include <ProgressManager.h>

Inheritance diagram for te::common::ProgressManager:
te::common::ObjectLevelLockable< ProgressManager,::boost::recursive_mutex,::boost::lock_guard< ::boost::recursive_mutex >,::boost::lock_guard< ::boost::recursive_mutex > > te::common::Singleton< ProgressManager >

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. More...
 
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 ProgressManagergetInstance ()
 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

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 >
 

Detailed Description

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.

See also
AbstractProgressViewer, TaskProgress

Definition at line 59 of file ProgressManager.h.

Member Typedef Documentation

typedef ObjectLevelLockingPolicy<::boost::lock_guard< ::boost::recursive_mutex > > te::common::ObjectLevelLockable< ProgressManager , ::boost::recursive_mutex , ::boost::lock_guard< ::boost::recursive_mutex > , ::boost::lock_guard< ::boost::recursive_mutex > >::LockRead
inherited

Definition at line 205 of file ThreadingPolicies.h.

typedef ObjectLevelLockingPolicy<::boost::lock_guard< ::boost::recursive_mutex > > te::common::ObjectLevelLockable< ProgressManager , ::boost::recursive_mutex , ::boost::lock_guard< ::boost::recursive_mutex > , ::boost::lock_guard< ::boost::recursive_mutex > >::LockWrite
inherited

Definition at line 206 of file ThreadingPolicies.h.

typedef volatile ProgressManager te::common::ObjectLevelLockable< ProgressManager , ::boost::recursive_mutex , ::boost::lock_guard< ::boost::recursive_mutex > , ::boost::lock_guard< ::boost::recursive_mutex > >::VolatileType
inherited

Definition at line 204 of file ThreadingPolicies.h.

Constructor & Destructor Documentation

te::common::ProgressManager::ProgressManager ( )
protected

Default constructor.

Definition at line 181 of file ProgressManager.cpp.

te::common::ProgressManager::~ProgressManager ( )
protected

Destructor.

Definition at line 187 of file ProgressManager.cpp.

Member Function Documentation

int te::common::ProgressManager::addTask ( TaskProgress tp)

Used in TaskProgress constructor, register this task generating a task id.

Parameters
tpTaskProgress instance
Returns
Task identifier
Note
Thread-safe!

Definition at line 59 of file ProgressManager.cpp.

Referenced by te::common::TaskProgress::TaskProgress().

int te::common::ProgressManager::addViewer ( AbstractProgressViewer apv)

Attach a progress viewer.

Parameters
apvProgress viewer instance
Returns
Progress viewer identifier
Note

Definition at line 31 of file ProgressManager.cpp.

References te::common::AbstractProgressViewer::addTask(), generateViewerId(), m_tasks, and m_viewers.

Referenced by te::qt::widgets::SegmenterWizardPage::apply(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::widgets::VectorizationWizard::execute(), te::qt::widgets::RegisterWizard::execute(), te::qt::widgets::ClassifierWizard::execute(), te::qt::widgets::FilterWizard::execute(), te::qt::widgets::ClippingWizard::execute(), te::qt::widgets::ColorTransformWizard::execute(), te::qt::widgets::ContrastWizard::execute(), te::qt::widgets::SegmenterWizard::execute(), te::vp::GeometricOpWizard::execute(), te::qt::widgets::ArithmeticOpWizard::execute(), te::qt::widgets::MosaicWizard::executeGeoMosaic(), te::qt::widgets::FusionWizard::executeIHS(), te::qt::widgets::FusionWizard::executePCA(), te::qt::widgets::MosaicWizard::executeSequenceMosaic(), te::qt::widgets::MosaicWizard::executeTiePointMosaic(), te::qt::widgets::FusionWizard::executeWisper(), te::qt::af::BaseApplication::makeDialog(), te::qt::plugins::cellspace::CreateCellularSpaceDialog::onCreatePushButtonClicked(), te::sa::BayesGlobalDialog::onOkPushButtonClicked(), te::sa::ProximityMatrixCreatorDialog::onOkPushButtonClicked(), te::sa::SkaterDialog::onOkPushButtonClicked(), te::sa::SamplePointsGeneratorDialog::onOkPushButtonClicked(), te::sa::BayesLocalDialog::onOkPushButtonClicked(), te::sa::SpatialStatisticsDialog::onOkPushButtonClicked(), te::sa::KernelRatioDialog::onOkPushButtonClicked(), te::sa::KernelMapDialog::onOkPushButtonClicked(), te::vp::PolygonToLineDialog::onOkPushButtonClicked(), te::vp::LineToPolygonDialog::onOkPushButtonClicked(), te::vp::IntersectionDialog::onOkPushButtonClicked(), te::vp::MultipartToSinglepartDialog::onOkPushButtonClicked(), te::attributefill::VectorToRasterDialog::onOkPushButtonClicked(), te::attributefill::RasterToVectorDialog::onOkPushButtonClicked(), te::vp::BufferDialog::onOkPushButtonClicked(), te::attributefill::VectorToVectorDialog::onOkPushButtonClicked(), and te::vp::AggregationDialog::onOkPushButtonClicked().

void te::common::ProgressManager::cancelTask ( int  taskId)

Inform all viewers that a task was canceled.

Parameters
taskIdTask identifier.

Definition at line 102 of file ProgressManager.cpp.

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.

Parameters
typeThe task type.

Definition at line 120 of file ProgressManager.cpp.

Referenced by te::qt::af::BaseApplication::onStopDrawTriggered().

void te::common::ProgressManager::clearAll ( )

Removes references for Viewers and tasks.

Definition at line 175 of file ProgressManager.cpp.

Referenced by te::qt::af::BaseApplication::~BaseApplication().

int te::common::ProgressManager::generateTaskId ( )
protected

Used to generate a new task id (use internal counter).

Returns
Task identification as integer value.

Definition at line 197 of file ProgressManager.cpp.

int te::common::ProgressManager::generateViewerId ( )
protected

Used to generate a new viewer id (use internal counter).

Returns
Viewer identification as integer value.

Definition at line 192 of file ProgressManager.cpp.

Referenced by addViewer().

static ProgressManager & te::common::Singleton< ProgressManager >::getInstance ( )
staticinherited

It returns a reference to the singleton instance.

Returns
A reference to the singleton instance.

Referenced by te::qt::widgets::SegmenterWizardPage::apply(), te::common::TaskProgress::cancel(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::widgets::VectorizationWizard::execute(), te::qt::widgets::RegisterWizard::execute(), te::qt::widgets::ClassifierWizard::execute(), te::qt::widgets::FilterWizard::execute(), te::qt::widgets::ClippingWizard::execute(), te::qt::widgets::ColorTransformWizard::execute(), te::qt::widgets::ContrastWizard::execute(), te::qt::widgets::SegmenterWizard::execute(), te::vp::GeometricOpWizard::execute(), te::qt::widgets::ArithmeticOpWizard::execute(), te::qt::widgets::MosaicWizard::executeGeoMosaic(), te::qt::widgets::FusionWizard::executeIHS(), te::qt::widgets::FusionWizard::executePCA(), te::qt::widgets::MosaicWizard::executeSequenceMosaic(), te::qt::widgets::MosaicWizard::executeTiePointMosaic(), te::qt::widgets::FusionWizard::executeWisper(), te::qt::af::BaseApplication::makeDialog(), te::qt::plugins::cellspace::CreateCellularSpaceDialog::onCreatePushButtonClicked(), te::sa::ProximityMatrixCreatorDialog::onOkPushButtonClicked(), te::sa::BayesGlobalDialog::onOkPushButtonClicked(), te::sa::BayesLocalDialog::onOkPushButtonClicked(), te::sa::SamplePointsGeneratorDialog::onOkPushButtonClicked(), te::sa::SkaterDialog::onOkPushButtonClicked(), te::sa::KernelMapDialog::onOkPushButtonClicked(), te::sa::KernelRatioDialog::onOkPushButtonClicked(), te::sa::SpatialStatisticsDialog::onOkPushButtonClicked(), te::vp::LineToPolygonDialog::onOkPushButtonClicked(), te::vp::PolygonToLineDialog::onOkPushButtonClicked(), te::vp::IntersectionDialog::onOkPushButtonClicked(), te::vp::MultipartToSinglepartDialog::onOkPushButtonClicked(), te::attributefill::VectorToRasterDialog::onOkPushButtonClicked(), te::attributefill::RasterToVectorDialog::onOkPushButtonClicked(), te::vp::BufferDialog::onOkPushButtonClicked(), te::attributefill::VectorToVectorDialog::onOkPushButtonClicked(), te::vp::AggregationDialog::onOkPushButtonClicked(), te::qt::af::BaseApplication::onStopDrawTriggered(), te::common::TaskProgress::setCurrentStep(), te::common::TaskProgress::setMessage(), te::common::TaskProgress::setTotalSteps(), te::common::TaskProgress::TaskProgress(), te::qt::af::BaseApplication::~BaseApplication(), and te::common::TaskProgress::~TaskProgress().

void te::common::ProgressManager::removeTask ( int  taskId)

Used in TaskProgress destructor, remove task from singleton.

Parameters
taskIdTask identifier.
Note
Thread-safe!

Definition at line 80 of file ProgressManager.cpp.

Referenced by te::common::TaskProgress::~TaskProgress().

void te::common::ProgressManager::removeViewer ( int  viewerId)

Dettach a progress viewer.

Parameters
viewerIdProgress viewer identifier

Definition at line 49 of file ProgressManager.cpp.

Referenced by te::qt::widgets::SegmenterWizardPage::apply(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::widgets::VectorizationWizard::execute(), te::qt::widgets::RegisterWizard::execute(), te::qt::widgets::FilterWizard::execute(), te::qt::widgets::ClassifierWizard::execute(), te::qt::widgets::ColorTransformWizard::execute(), te::qt::widgets::ClippingWizard::execute(), te::qt::widgets::ContrastWizard::execute(), te::qt::widgets::SegmenterWizard::execute(), te::vp::GeometricOpWizard::execute(), te::qt::widgets::ArithmeticOpWizard::execute(), te::qt::widgets::MosaicWizard::executeGeoMosaic(), te::qt::widgets::FusionWizard::executeIHS(), te::qt::widgets::FusionWizard::executePCA(), te::qt::widgets::MosaicWizard::executeSequenceMosaic(), te::qt::widgets::MosaicWizard::executeTiePointMosaic(), te::qt::widgets::FusionWizard::executeWisper(), te::qt::plugins::cellspace::CreateCellularSpaceDialog::onCreatePushButtonClicked(), te::sa::BayesGlobalDialog::onOkPushButtonClicked(), te::sa::ProximityMatrixCreatorDialog::onOkPushButtonClicked(), te::sa::SamplePointsGeneratorDialog::onOkPushButtonClicked(), te::sa::SkaterDialog::onOkPushButtonClicked(), te::sa::BayesLocalDialog::onOkPushButtonClicked(), te::sa::SpatialStatisticsDialog::onOkPushButtonClicked(), te::sa::KernelMapDialog::onOkPushButtonClicked(), te::sa::KernelRatioDialog::onOkPushButtonClicked(), te::vp::LineToPolygonDialog::onOkPushButtonClicked(), te::vp::PolygonToLineDialog::onOkPushButtonClicked(), te::vp::IntersectionDialog::onOkPushButtonClicked(), te::vp::MultipartToSinglepartDialog::onOkPushButtonClicked(), te::attributefill::VectorToRasterDialog::onOkPushButtonClicked(), te::attributefill::RasterToVectorDialog::onOkPushButtonClicked(), te::vp::BufferDialog::onOkPushButtonClicked(), te::attributefill::VectorToVectorDialog::onOkPushButtonClicked(), and te::vp::AggregationDialog::onOkPushButtonClicked().

void te::common::ProgressManager::setTotalValues ( int  taskId)

Inform all viewers that a task set the total values.

Parameters
taskIdTask identifier.

Definition at line 139 of file ProgressManager.cpp.

Referenced by te::common::TaskProgress::setTotalSteps().

void te::common::ProgressManager::updateMessage ( int  taskId)

Inform all viewers that a task set the message.

Parameters
taskIdTask identifier.

Definition at line 163 of file ProgressManager.cpp.

Referenced by te::common::TaskProgress::setMessage().

void te::common::ProgressManager::updateValue ( int  taskId)

Inform all viewers that a task set the current step.

Parameters
taskIdTask identifier.

Definition at line 151 of file ProgressManager.cpp.

Referenced by te::common::TaskProgress::setCurrentStep().

Friends And Related Function Documentation

friend class te::common::Singleton< ProgressManager >
friend

Definition at line 65 of file ProgressManager.h.

Member Data Documentation

int te::common::ProgressManager::m_taskCounter
protected

Counter used to generate a task id.

Definition at line 171 of file ProgressManager.h.

std::map<int, TaskProgress*> te::common::ProgressManager::m_tasks
protected

Container with tasks.

Definition at line 173 of file ProgressManager.h.

Referenced by addViewer().

int te::common::ProgressManager::m_viewerCounter
protected

Counter used to generate a viewer id.

Definition at line 172 of file ProgressManager.h.

std::map<int, AbstractProgressViewer*> te::common::ProgressManager::m_viewers
protected

Container with viewers.

Definition at line 174 of file ProgressManager.h.

Referenced by addViewer().


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