summaryrefslogtreecommitdiffhomepage
path: root/options/connector.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-18 14:53:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-18 17:05:13 +0200
commita18ca7764abbe24b601885ef06fcc98f0b7ed10b (patch)
tree1381ca22c6b2e68f5e43f0443435863eb3578c77 /options/connector.hpp
parent132a1925340bcd75a88f831a3487044736dccb4a (diff)
options: factor out connector out of bundle
Diffstat (limited to 'options/connector.hpp')
-rw-r--r--options/connector.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/options/connector.hpp b/options/connector.hpp
new file mode 100644
index 00000000..dea9fd0f
--- /dev/null
+++ b/options/connector.hpp
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <map>
+#include <vector>
+#include <QString>
+#include <QMutex>
+#include <QMutexLocker>
+
+#include "export.hpp"
+
+namespace options {
+
+class base_value;
+
+namespace detail {
+
+class OPENTRACK_OPTIONS_EXPORT connector
+{
+ friend class ::options::base_value;
+
+ std::map<QString, std::vector<const base_value*>> connected_values;
+
+ void on_bundle_destructed(const QString& name, const base_value* val);
+ void on_bundle_created(const QString& name, const base_value* val);
+
+protected:
+ void notify_values(const QString& name) const;
+ void notify_all_values() const;
+ virtual QMutex* get_mtx() = 0;
+
+public:
+ connector();
+ virtual ~connector();
+
+ connector(const connector&) = default;
+ connector& operator=(const connector&) = default;
+ connector(connector&&) = default;
+ connector& operator=(connector&&) = default;
+};
+
+}
+}