VPTissue Reference Manual
ExplorationProgress.h
Go to the documentation of this file.
1 #ifndef SIMPT_PAREX_EXPLORATION_PROGRESS_H_
2 #define SIMPT_PAREX_EXPLORATION_PROGRESS_H_
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "ExplorationTask.h"
23 #include "SimResult.h"
24 
25 #include <QObject>
26 #include <map>
27 #include <vector>
28 
29 namespace SimPT_Parex {
30 
31 class Exploration;
32 class SimTask;
33 
59 {
60  Q_OBJECT
61 public:
66  ExplorationProgress(const Exploration* exploration);
67 
74  ExplorationProgress(const boost::property_tree::ptree& pt);
75 
79  virtual ~ExplorationProgress();
80 
85  void CancelWaitingTask(unsigned int id);
86 
90  const Exploration& GetExploration() const { return *m_exploration; }
91 
95  const std::list<unsigned int>& GetRunningTasks() const { return m_running_tasks; }
96 
102  const ExplorationTask& GetTask(unsigned int id) const;
103 
109  unsigned int GetTaskCount(const TaskState& state) const;
110 
116  void GiveBack(const SimTask* task);
117 
122  bool IsFinished() const;
123 
129  SimTask* NextTask();
130 
135  void ResendCancelledTask(unsigned int id);
136 
153  boost::property_tree::ptree ToPtree() const;
154 
155 public slots:
160  void HandleResult(const SimResult &result);
161 
162 signals:
166  void Updated();
167 
168 private:
175  void ChangeState(ExplorationTask& task, TaskState state);
176 
182  void ReadPtree(const boost::property_tree::ptree& pt);
183 
184 private:
185  const Exploration* m_exploration;
186  std::list<unsigned int> m_send_queue;
187  std::vector<ExplorationTask> m_tasks;
188  std::map<TaskState, unsigned int> m_task_counts;
189  std::list<unsigned int> m_running_tasks;
190 
191  static const unsigned int g_max_tries = 3;
192 };
193 
194 } // namespace
195 
196 #endif // end-of-include-guard
TaskState
Enumeration describing the state of a single task of the exploration.
bool IsFinished() const
Return true if the exploration has finished.
ExplorationProgress(const Exploration *exploration)
Constructor.
Interface for ExplorationTask.
A container class for the final result of a simulation.
Definition: SimResult.h:29
Class describing the progress state of an exploration.
boost::property_tree::ptree ToPtree() const
Convert the exploration and progress to a ptree.
void GiveBack(const SimTask *task)
Give a task back to exploration (when it could not have been sent).
void ResendCancelledTask(unsigned int id)
Resends a cancelled task.
void Updated()
Signal called when Exploration has changed.
unsigned int GetTaskCount(const TaskState &state) const
Returns the number of tasks with the specified state.
Interface for SimResult.
virtual ~ExplorationProgress()
Destructor.
void HandleResult(const SimResult &result)
Handles the result of a simulation task.
SimTask * NextTask()
Return the next task ready to be simulated.
Contains information about task in an exploration.
const ExplorationTask & GetTask(unsigned int id) const
Returns the state of the task with the specified id.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
const Exploration & GetExploration() const
Returns the exploration of this object.
Contains all information needed for a transmitable simulation task.
Definition: SimTask.h:31
see the online Qt documentation
Class describing a generic exploration.
Definition: Exploration.h:33
void CancelWaitingTask(unsigned int id)
Cancels a waiting task.
const std::list< unsigned int > & GetRunningTasks() const
Returns the running tasks.