basic_sheet.hppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ADOBE_BASIC_SHEET_HPP
00010 #define ADOBE_BASIC_SHEET_HPP
00011
00012 #include <adobe/config.hpp>
00013
00014 #include <deque>
00015 #include <map>
00016 #include <vector>
00017
00018 #include <boost/signal.hpp>
00019 #include <boost/function.hpp>
00020
00021 #include <adobe/dictionary_fwd.hpp>
00022
00023 #include <adobe/any_regular.hpp>
00024 #include <adobe/name.hpp>
00025 #include <adobe/string.hpp>
00026
00027
00028
00029 namespace adobe {
00035
00036
00040 class basic_sheet_t : boost::noncopyable
00041 {
00042 public:
00043
00044 typedef boost::signals::connection connection_t;
00045 typedef boost::function<void (const any_regular_t&)> monitor_value_t;
00046 typedef boost::signal<void (const any_regular_t&)> monitor_value_list_t;
00047 void add_constant(name_t, const any_regular_t&);
00048 void add_interface(name_t, const any_regular_t&);
00049
00050 std::size_t count_interface(name_t) const;
00051
00052 connection_t monitor_value(name_t name, const monitor_value_t& monitor);
00053
00054 void set(name_t, const any_regular_t&);
00055 void set(const dictionary_t& cell_set);
00056
00057 const any_regular_t& operator[](name_t) const;
00058
00059 dictionary_t contributing() const;
00060
00061 private:
00062
00063 struct cell_t
00064 {
00065 cell_t(const any_regular_t& value) : value_m(value) { }
00066 any_regular_t value_m;
00067 };
00068
00069 struct interface_cell_t : cell_t
00070 {
00071 interface_cell_t(const any_regular_t& value) : cell_t(value) { }
00072
00073 interface_cell_t(const interface_cell_t& x) : cell_t(x.value_m) { }
00074 interface_cell_t& operator=(const interface_cell_t& x)
00075 {
00076 value_m = x.value_m;
00077
00078 return *this;
00079 }
00080
00081 monitor_value_list_t monitor_value_m;
00082 };
00083
00084 typedef std::map<const char*, interface_cell_t*, str_less_t> interface_index_t;
00085 typedef std::map<const char*, const cell_t*, str_less_t> variable_index_t;
00086
00087 interface_cell_t* lookup_interface(name_t);
00088
00089 variable_index_t variable_index_m;
00090 interface_index_t interface_index_m;
00091
00092 std::deque<cell_t> constant_cell_set_m;
00093 std::deque<interface_cell_t> interface_cell_set_m;
00094 };
00095
00096
00097
00098 }
00099
00100
00101
00102 #endif
00103
00104
|