summaryrefslogtreecommitdiffhomepage
path: root/options/connector.hpp
blob: dea9fd0f549ad56398dfc93f731c505657daed8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
};

}
}