aboutsummaryrefslogtreecommitdiff
path: root/problem.hpp
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-01 18:07:20 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-01 18:07:20 +0100
commit29158da41e7943ea8019efdbff70c994fb1c73e9 (patch)
tree458cc13b97346d9d72c92119823c2f76bc2ddb57 /problem.hpp
parent3b8497a4d6c71ac542a2992a645c00bf99d45390 (diff)
downloadRobotique-Projet-29158da41e7943ea8019efdbff70c994fb1c73e9.tar.gz
Robotique-Projet-29158da41e7943ea8019efdbff70c994fb1c73e9.zip
Begin work on worker thread
Diffstat (limited to 'problem.hpp')
-rw-r--r--problem.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/problem.hpp b/problem.hpp
index 685e1df..8851fa2 100644
--- a/problem.hpp
+++ b/problem.hpp
@@ -2,6 +2,7 @@
#include <vector>
#include <map>
+#include <SFML/System.hpp>
#include "geom.hpp"
@@ -87,18 +88,35 @@ struct solver_internal {
// represents a graph of randomly chosen positions and simple solutions between them
std::vector<hilare_a> pts;
std::map<int, std::map<int, solution> > paths;
+
+ void initialize(const problem &p);
+ solution try_find_solution();
+ void step(const problem &p);
};
class solver {
// mutex-protected asynchronous structure
private:
+
+ sf::Mutex _d_lock;
solver_internal _d;
+ problem _p;
+
+ bool _please_stop;
+ bool _running;
+ bool _done;
+ solution _s;
+
+ sf::Thread _worker;
public:
solver();
void start(const problem &p);
+
+ void run(); // worker thread
+
bool finished();
solution get_solution();