37 m_viewers.insert(std::map<int, AbstractProgressViewer*>::value_type(
id, apv));
53 std::map<int, AbstractProgressViewer*>::iterator it =
m_viewers.find(viewerId);
67 m_tasks.insert(std::map<int, TaskProgress*>::value_type(
id, tp));
70 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
75 itV->second->addTask(tp,
id);
87 std::map<int, TaskProgress*>::iterator it =
m_tasks.find(taskId);
92 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
97 itV->second->removeTask(taskId);
111 std::map<int, TaskProgress*>::iterator it =
m_tasks.find(taskId);
116 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
120 itV->second->cancelTask(taskId);
134 std::vector<TaskProgress*> cancelled;
135 std::map<int, TaskProgress*>::iterator it =
m_tasks.begin();
139 if(it->second->getType() == type)
140 cancelled.push_back(it->second);
145 for(std::size_t i = 0; i < cancelled.size(); ++i)
146 cancelled[i]->cancel();
154 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
158 itV->second->setTotalValues(taskId);
169 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
173 itV->second->updateValue(taskId);
184 std::map<int, AbstractProgressViewer*>::iterator itV =
m_viewers.begin();
188 itV->second->updateMessage(taskId);
This class can be used to inform the progress of a task.
A singleton class used to manage tasks progresses and their viewers.
int addTask(TaskProgress *tp)
Used in TaskProgress constructor, register this task generating a task id.
int m_taskCounter
Counter used to generate a task id.
std::map< int, TaskProgress * > m_tasks
Container with tasks.
This class can be used to inform the progress of a task.
void cancelTask(int taskId)
Inform all viewers that a task was canceled.
int m_viewerCounter
Counter used to generate a viewer id.
int generateTaskId()
Used to generate a new task id (use internal counter).
A class that defines the interface of an abstract progress viewer.
void removeViewer(int viewerId)
Dettach a progress viewer (AbstractProgressViewer destructor calls this method).
A class that defines the interface of an abstract progress viewer.
void setTotalValues(int taskId)
Inform all viewers that a task set the total values.
void cancelTasks(unsigned int type)
Cancels the task with the given task type and inform all viewers that a task was canceled.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
void removeTask(int taskId)
Used in TaskProgress destructor, remove task from singleton.
~ProgressManager()
Destructor.
std::map< int, AbstractProgressViewer * > m_viewers
Container with viewers.
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
ProgressManager()
Default constructor.
void updateMessage(int taskId)
Inform all viewers that a task set the message.
void clearAll()
Removes references for Viewers and tasks.
int generateViewerId()
Used to generate a new viewer id (use internal counter).
void updateValue(int taskId)
Inform all viewers that a task set the current step.