stlab.adobe.com Adobe Systems Incorporated

external_model.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_EXTERNAL_MODEL_HPP
00010 #define ADOBE_EXTERNAL_MODEL_HPP
00011 
00012 #include <adobe/config.hpp>
00013 
00014 #include <deque>
00015 #include <map>
00016 
00017 #include <boost/signal.hpp>
00018 #include <boost/function.hpp>
00019 
00020 #include <adobe/any_regular_fwd.hpp>
00021 #include <adobe/name.hpp>
00022 #include <adobe/string.hpp>
00023 
00024 /*************************************************************************************************/
00025 
00026 namespace adobe {
00032 /*************************************************************************************************/
00033 
00037 class external_model_t : boost::noncopyable
00038 {
00039  public:
00040     
00041     typedef boost::signals::connection connection_t;
00042     typedef boost::function<void (const any_regular_t&)> monitor_t;
00043     
00044     void add_cell(name_t);
00045     
00046     std::size_t count(name_t) const;
00047     connection_t monitor(name_t name, const monitor_t& monitor);
00048     void set(name_t, const any_regular_t&);
00049     
00050     void model_monitor(name_t name, const monitor_t& monitor);
00051     void model_set(name_t, const any_regular_t&);
00052 
00053  private:
00054     typedef boost::signal<void (const any_regular_t&)>   monitor_list_t;
00055     
00056     struct cell_t
00057     {
00058         // empty copy and assignment - we don't move connections.
00059         cell_t() { }
00060         cell_t(const cell_t&) { }
00061         cell_t& operator=(const cell_t&) { return *this; }
00062     
00063         monitor_list_t  monitor_m;
00064         monitor_t       model_monitor_m;
00065     };
00066         
00067     typedef std::map<const char*, cell_t*, str_less_t>    index_t;
00068     
00069     cell_t* lookup(name_t);
00070     
00071     index_t                index_m;
00072     std::deque<cell_t>     cell_set_m;
00073 };
00074 
00075 /*************************************************************************************************/
00076 
00077 } // namespace adobe
00078 
00079 /*************************************************************************************************/
00080 
00081 #endif
00082 
00083 /*************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google