summaryrefslogtreecommitdiffstats
path: root/src/gui/ThreadedLoader.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/ThreadedLoader.hpp')
-rw-r--r--src/gui/ThreadedLoader.hpp73
1 files changed, 41 insertions, 32 deletions
diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp
index 3ab8f4a2..27ba7c8c 100644
--- a/src/gui/ThreadedLoader.hpp
+++ b/src/gui/ThreadedLoader.hpp
@@ -17,25 +17,32 @@
#ifndef INGEN_GUI_THREADEDLOADER_HPP
#define INGEN_GUI_THREADEDLOADER_HPP
-#include "ingen/FilePath.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Parser.hpp"
-#include "ingen/Serialiser.hpp"
-#include "raul/Semaphore.hpp"
+#include <ingen/FilePath.hpp>
+#include <raul/Semaphore.hpp>
-#include <boost/optional/optional.hpp>
-#include <sigc++/sigc++.h>
+#include <sigc++/functors/slot.h>
#include <list>
+#include <memory>
#include <mutex>
+#include <optional>
#include <thread>
-#include <utility>
+
+namespace raul {
+class Path;
+class Symbol;
+} // namespace raul
namespace ingen {
+class Interface;
+class Parser;
+class Properties;
class URI;
-namespace client { class GraphModel; }
+namespace client {
+class GraphModel;
+} // namespace client
namespace gui {
@@ -43,7 +50,7 @@ class App;
/** Thread for loading graph files.
*
- * This is a seperate thread so it can send all the loading message without
+ * This is a separate thread so it can send all the loading message without
* blocking everything else, so the app can respond to the incoming events
* caused as a result of the graph loading, while the graph loads.
*
@@ -56,41 +63,43 @@ class ThreadedLoader
{
public:
ThreadedLoader(App& app,
- SPtr<Interface> engine);
+ std::shared_ptr<Interface> engine);
~ThreadedLoader();
- void load_graph(bool merge,
- const FilePath& file_path,
- boost::optional<Raul::Path> engine_parent,
- boost::optional<Raul::Symbol> engine_symbol,
- boost::optional<Properties> engine_data);
+ void load_graph(bool merge,
+ const FilePath& file_path,
+ const std::optional<raul::Path>& engine_parent,
+ const std::optional<raul::Symbol>& engine_symbol,
+ const std::optional<Properties>& engine_data);
- void save_graph(SPtr<const client::GraphModel> model, const URI& uri);
+ void save_graph(const std::shared_ptr<const client::GraphModel>& model,
+ const URI& uri);
- SPtr<Parser> parser();
+ std::shared_ptr<Parser> parser();
private:
- void load_graph_event(const FilePath& file_path,
- boost::optional<Raul::Path> engine_parent,
- boost::optional<Raul::Symbol> engine_symbol,
- boost::optional<Properties> engine_data);
+ void load_graph_event(const FilePath& file_path,
+ const std::optional<raul::Path>& engine_parent,
+ const std::optional<raul::Symbol>& engine_symbol,
+ const std::optional<Properties>& engine_data);
- void save_graph_event(SPtr<const client::GraphModel> model,
- const URI& filename);
+ void
+ save_graph_event(const std::shared_ptr<const client::GraphModel>& model,
+ const URI& uri);
- /** Returns nothing and takes no parameters (because they have all been bound) */
+ /// Returns nothing and takes no parameters (because they're all bound)
using Closure = sigc::slot<void>;
void run();
- App& _app;
- Raul::Semaphore _sem;
- SPtr<Interface> _engine;
- std::mutex _mutex;
- std::list<Closure> _events;
- bool _exit_flag;
- std::thread _thread;
+ App& _app;
+ raul::Semaphore _sem{0};
+ std::shared_ptr<Interface> _engine;
+ std::mutex _mutex;
+ std::list<Closure> _events;
+ bool _exit_flag{false};
+ std::thread _thread;
};
} // namespace gui