Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
external_model.hpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Adobe
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5*/
6/**************************************************************************************************/
7
8#ifndef ADOBE_EXTERNAL_MODEL_HPP
9#define ADOBE_EXTERNAL_MODEL_HPP
10
11#include <adobe/config.hpp>
12
13#include <deque>
14#include <functional>
15#include <map>
16
17#include <boost/signals2/signal.hpp>
18
20#include <adobe/name.hpp>
21#include <adobe/string.hpp>
22
23/**************************************************************************************************/
24
25namespace adobe {
30
31/**************************************************************************************************/
32
36class external_model_t : boost::noncopyable {
37public:
38 using connection_t = boost::signals2::connection;
39 using monitor_t = std::function<void(const any_regular_t&)>;
40
42
43 std::size_t count(name_t) const;
45 void set(name_t, const any_regular_t&);
46
49
50private:
51 typedef boost::signals2::signal<void(const any_regular_t&)> monitor_list_t;
52
53 struct cell_t {
54 // empty copy and assignment - we don't move connections.
55 cell_t() {}
56 cell_t(const cell_t&) {}
57 cell_t& operator=(const cell_t&) { return *this; }
58
59 monitor_list_t monitor_m;
60 monitor_t model_monitor_m;
61 };
62
63 typedef std::map<const char*, cell_t*, str_less_t> index_t;
64
65 cell_t* lookup(name_t);
66
67 index_t index_m;
68 std::deque<cell_t> cell_set_m;
69};
70
71/**************************************************************************************************/
72
73} // namespace adobe
74
75/**************************************************************************************************/
76
77#endif
78
79/**************************************************************************************************/
std::function< void(const any_regular_t &)> monitor_t
void set(name_t, const any_regular_t &)
std::size_t count(name_t) const
connection_t monitor(name_t name, const monitor_t &monitor)
void model_set(name_t, const any_regular_t &)
boost::signals2::connection connection_t
void model_monitor(name_t name, const monitor_t &monitor)
A runtime polymorphic type similar to boost::any which can hold any type which models Regular.
A character string class for immutable strings.
Definition name.hpp:220