stlab.adobe.com Adobe Systems Incorporated

poly_sequence_controller.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2006-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_POLY_SEQUENCE_CONTROLLER_HPP
00010 #define ADOBE_POLY_SEQUENCE_CONTROLLER_HPP
00011 
00012 /*************************************************************************************************/
00013 
00014 #include <adobe/config.hpp>
00015 
00016 #include <boost/function.hpp>
00017 
00018 #include <adobe/poly.hpp>
00019 #include <adobe/sequence_controller.hpp>
00020 #include <adobe/poly_sequence_model.hpp>
00021 #include <adobe/vector.hpp>
00022 
00023 /*************************************************************************************************/
00024 
00025 namespace adobe {
00026 
00027 /*************************************************************************************************/
00033 /*************************************************************************************************/
00039 template <typename T>
00040 struct poly_sequence_controller_interface : poly_copyable_interface
00041 {
00042     virtual void monitor_sequence(typename poly_sequence_model<T>::type&) = 0;
00043 };
00044 
00045 /*************************************************************************************************/
00051 template <typename T>
00052 struct poly_sequence_controller_instance 
00053 {
00054     template <typename V>
00055     struct type : optimized_storage_type<V, poly_sequence_controller_interface<T> >::type
00056     {
00057         typedef typename optimized_storage_type<V, poly_sequence_controller_interface<T> >::type base_t;
00058 
00059         BOOST_CLASS_REQUIRE(V, adobe, SequenceControllerConcept);
00060 
00061         explicit type(const V& x) :
00062             base_t(x)
00063         { }
00064 
00065         type(move_from<type> x) :
00066             base_t(move_from<base_t>(x.source))
00067         { }
00068 
00069         void monitor_sequence(typename poly_sequence_model<T>::type& sequence)
00070         { SequenceControllerConcept<V>::monitor_sequence(this->get(), sequence); }
00071     };
00072 };
00073 
00074 /*************************************************************************************************/
00080 template <typename T>
00081 struct sequence_controller : poly_base<poly_sequence_controller_interface<T>,
00082                                        poly_sequence_controller_instance<T>::template type>
00083 {
00084     typedef poly_base<poly_sequence_controller_interface<T>,
00085                       poly_sequence_controller_instance<T>::template type> base_t;
00086 
00087     typedef T value_type;
00088 
00089     template <typename V>
00090     explicit sequence_controller(const V& s) :
00091         base_t(s)
00092     { }
00093 
00094     sequence_controller(move_from<sequence_controller> x) :
00095         base_t(move_from<base_t>(x.source))
00096     { }
00097 
00098     void monitor_sequence(typename poly_sequence_model<T>::type& sequence)
00099     { this->interface_ref().monitor_sequence(sequence); }
00100 };
00101 
00102 /*************************************************************************************************/
00103 
00104 template <typename T>
00105 struct poly_sequence_controller
00106 {
00107     typedef poly< sequence_controller<T> > type;
00108 };
00109 
00110 /*************************************************************************************************/
00111 
00112 } // namespace adobe
00113 
00114 /*************************************************************************************************/
00115 
00116 // ADOBE_POLY_SEQUENCE_CONTROLLER_HPP
00117 #endif 
00118 
00119 /*************************************************************************************************/

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