poly_regular.hppGo 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_REGULAR_HPP 00010 #define ADOBE_POLY_REGULAR_HPP 00011 00012 #include <adobe/config.hpp> 00013 00014 #include <boost/concept_check.hpp> 00015 00016 #include <adobe/poly.hpp> 00017 #include <adobe/regular_concept.hpp> 00018 #include <adobe/empty.hpp> 00019 00020 /*************************************************************************************************/ 00021 00022 namespace adobe { 00023 00028 /*************************************************************************************************/ 00034 struct poly_regular_interface : poly_copyable_interface 00035 { 00036 virtual bool equals(const poly_regular_interface& new_value) const = 0; 00037 }; 00038 00039 /*************************************************************************************************/ 00040 00048 template <typename T> 00049 struct poly_regular_instance : optimized_storage_type<T, poly_regular_interface>::type 00050 { 00051 typedef typename optimized_storage_type<T, poly_regular_interface>::type base_t; 00052 00056 BOOST_CLASS_REQUIRE(T, adobe, RegularConcept); 00057 00061 poly_regular_instance(const T& x) : base_t(x) {} 00062 00066 poly_regular_instance(move_from<poly_regular_instance> x) 00067 : base_t(move_from<base_t>(x.source)) {} 00068 00069 bool equals(const poly_regular_interface& x) const 00070 { return this->type_info() == x.type_info() && this->get() == *static_cast<const T*>(x.cast()); } 00071 00072 }; 00073 00074 /*************************************************************************************************/ 00075 00082 struct regular : poly_base<poly_regular_interface, poly_regular_instance> 00083 { 00084 typedef poly_base<poly_regular_interface, poly_regular_instance> base_t; 00085 00089 template <typename T> 00090 explicit regular(const T& s) 00091 : base_t(s) { } 00092 00093 regular() 00094 : base_t(empty_t()) { } 00095 00099 regular(move_from<regular> x) 00100 : base_t(move_from<base_t>(x.source)) {} 00101 00102 }; 00103 00104 00105 /*************************************************************************************************/ 00106 00107 #if !defined(ADOBE_NO_DOCUMENTATION) 00108 00109 /*************************************************************************************************/ 00110 00111 typedef poly<regular> poly_regular_t; 00112 00113 /*************************************************************************************************/ 00114 00115 #endif 00116 00117 /*************************************************************************************************/ 00118 00119 } // namespace adobe 00120 00121 /*************************************************************************************************/ 00122 00123 #endif | ||||

