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 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 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

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 >
 

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.

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

Destructor.

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!
int te::common::ProgressManager::addViewer ( AbstractProgressViewer apv)

Attach a progress viewer.

Parameters
apvProgress viewer instance
Returns
Progress viewer identifier
Note
void te::common::ProgressManager::cancelTask ( int  taskId)

Inform all viewers that a task was canceled.

Parameters
taskIdTask identifier.
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.
void te::common::ProgressManager::clearAll ( )

Removes references for Viewers and tasks.

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

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

Returns
Task identification as integer value.
int te::common::ProgressManager::generateViewerId ( )
protected

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

Returns
Viewer identification as integer value.
static ProgressManager & te::common::Singleton< ProgressManager >::getInstance ( )
staticinherited

It returns a reference to the singleton instance.

Returns
A reference to the singleton instance.
void te::common::ProgressManager::removeTask ( int  taskId)

Used in TaskProgress destructor, remove task from singleton.

Parameters
taskIdTask identifier.
Note
Thread-safe!
void te::common::ProgressManager::removeViewer ( int  viewerId)

Dettach a progress viewer.

Parameters
viewerIdProgress viewer identifier
void te::common::ProgressManager::setSuspendViewers ( bool  flag)
inline

Definition at line 147 of file ProgressManager.h.

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

Inform all viewers that a task set the total values.

Parameters
taskIdTask identifier.
void te::common::ProgressManager::updateMessage ( int  taskId)

Inform all viewers that a task set the message.

Parameters
taskIdTask identifier.
void te::common::ProgressManager::updateValue ( int  taskId)

Inform all viewers that a task set the current step.

Parameters
taskIdTask identifier.

Friends And Related Function Documentation

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

Definition at line 65 of file ProgressManager.h.

Member Data Documentation

bool te::common::ProgressManager::m_suspendViewers
protected

Definition at line 178 of file ProgressManager.h.

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

Counter used to generate a task id.

Definition at line 173 of file ProgressManager.h.

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

Container with tasks.

Definition at line 175 of file ProgressManager.h.

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

Counter used to generate a viewer id.

Definition at line 174 of file ProgressManager.h.

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

Container with viewers.

Definition at line 176 of file ProgressManager.h.


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