VPTissue Reference Manual
ExplorationManager.h
Go to the documentation of this file.
1 #ifndef SIMPT_PAREX_EXPLORATION_MANAGER_H_
2 #define SIMPT_PAREX_EXPLORATION_MANAGER_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 <QObject>
23 #include <deque>
24 #include <map>
25 #include <unordered_map>
26 #include <vector>
27 
28 namespace SimPT_Parex {
29 
30 class Exploration;
31 class ExplorationProgress;
32 class SimTask;
33 class WorkerRepresentative;
34 
39 {
40  Q_OBJECT
41 public:
46 
50  virtual ~ExplorationManager();
51 
52 
56  const ExplorationProgress *GetExplorationProgress(const std::string &explorationName);
57 
61  std::vector<std::string> GetExplorationNames();
62 
63 signals:
67  void Updated();
68 
69 public slots:
74  void RegisterExploration(const Exploration *exploration);
75 
79  void DeleteExploration(const std::string &name);
80 
84  void StopTask(const std::string &name, int id);
85 
89  void RestartTask(const std::string &name, int id);
90 
91 private slots:
92  void BackUp();
93 
94  void NewWorkerAvailable();
95 
96  void WorkerDisconnected();
97 
98  void WorkerFinished();
99 
100  void WorkerReconnected(WorkerRepresentative*);
101 
102 private:
104  void Read_Backup();
105 
107  bool WorkAvailable();
108 
110  ExplorationProgress *GetExploration(const std::string &name, const std::deque<ExplorationProgress*>&);
111 
113  void RemoveExploration(const std::string &name, std::deque<ExplorationProgress*>&);
114 
115 private:
116  std::deque<ExplorationProgress*> m_running_explorations;
117  std::deque<ExplorationProgress*> m_done_explorations;
118  std::map<WorkerRepresentative*, SimTask*> m_running_tasks;
119 
120 };
121 
122 } // namespace
123 
124 #endif // end-of-include-guard
std::vector< std::string > GetExplorationNames()
Get a list of all registered explorations.
Class describing the progress state of an exploration.
void RegisterExploration(const Exploration *exploration)
Request that the exploration will be simulated somewhere.
void RestartTask(const std::string &name, int id)
Resend a specific task that has been stopped.
Collects all explorations and works with WorkerPool to actually execute them.
void DeleteExploration(const std::string &name)
Delete a given Exploration.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
see the online Qt documentation
Class describing a generic exploration.
Definition: Exploration.h:33
const ExplorationProgress * GetExplorationProgress(const std::string &explorationName)
Lookup the exploration by name.
void Updated()
Emitted whenever a change to an exploration is done.
virtual ~ExplorationManager()
Destructor.
A worker taken as representative for multiple workers (handles the communication with the node)...
void StopTask(const std::string &name, int id)
Stop a node from runnning a specific task.