forked from stlab/adobe_source_libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternal_model.hpp
79 lines (56 loc) · 2.17 KB
/
external_model.hpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Copyright 2013 Adobe
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
/**************************************************************************************************/
#ifndef ADOBE_EXTERNAL_MODEL_HPP
#define ADOBE_EXTERNAL_MODEL_HPP
#include <adobe/config.hpp>
#include <deque>
#include <map>
#include <boost/function.hpp>
#include <boost/signals2/signal.hpp>
#include <adobe/any_regular_fwd.hpp>
#include <adobe/name.hpp>
#include <adobe/string.hpp>
/**************************************************************************************************/
namespace adobe {
/*!
\defgroup external_model External Model
\ingroup property_model
*/
/**************************************************************************************************/
/*!
\ingroup external_model
*/
class external_model_t : boost::noncopyable {
public:
typedef boost::signals2::connection connection_t;
typedef boost::function<void(const any_regular_t&)> monitor_t;
void add_cell(name_t);
std::size_t count(name_t) const;
connection_t monitor(name_t name, const monitor_t& monitor);
void set(name_t, const any_regular_t&);
void model_monitor(name_t name, const monitor_t& monitor);
void model_set(name_t, const any_regular_t&);
private:
typedef boost::signals2::signal<void(const any_regular_t&)> monitor_list_t;
struct cell_t {
// empty copy and assignment - we don't move connections.
cell_t() {}
cell_t(const cell_t&) {}
cell_t& operator=(const cell_t&) { return *this; }
monitor_list_t monitor_m;
monitor_t model_monitor_m;
};
typedef std::map<const char*, cell_t*, str_less_t> index_t;
cell_t* lookup(name_t);
index_t index_m;
std::deque<cell_t> cell_set_m;
};
/**************************************************************************************************/
} // namespace adobe
/**************************************************************************************************/
#endif
/**************************************************************************************************/