aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/ValueBroker.h
blob: 9d30a2ed6389a828a6a56fb9001ee78d4741c6c2 (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
#pragma once

#include <functional>

namespace crepe {

template <typename T>
class ValueBroker {
public:
	virtual void set(const T &);
	virtual const T & get();

	typedef std::function<void(T & value, const T & target)> setter_t;
	typedef std::function<const T & (T & value)> getter_t;
private:
	T & value;
	setter_t setter;
	getter_t getter;
public:
	ValueBroker(T &, const setter_t &, const getter_t &);
	ValueBroker(T &);
};

}

#include "ValueBroker.hpp"