stlab.adobe.com Adobe Systems Incorporated
poly_regular.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 
6  Author(s): Mat Marcus
7 */
8 
9 /*************************************************************************************************/
10 
11 #ifndef ADOBE_POLY_REGULAR_HPP
12 #define ADOBE_POLY_REGULAR_HPP
13 
14 #include <adobe/config.hpp>
15 
16 #include <boost/concept_check.hpp>
17 
18 #include <adobe/poly.hpp>
20 #include <adobe/empty.hpp>
21 
22 /*************************************************************************************************/
23 
24 namespace adobe {
25 
30 /*************************************************************************************************/
37 {
38  virtual bool equals(const poly_regular_interface& new_value) const = 0;
39 };
40 
41 /*************************************************************************************************/
42 
50 template <typename T>
51 struct poly_regular_instance : optimized_storage_type<T, poly_regular_interface>::type
52 {
54 
59 
63  poly_regular_instance(const T& x) : base_t(x) {}
64 
69  : base_t(move_from<base_t>(x.source)) {}
70 
71  bool equals(const poly_regular_interface& x) const
72  { return this->type_info() == x.type_info() && this->get() == *static_cast<const T*>(x.cast()); }
73 
74 };
75 
76 /*************************************************************************************************/
77 
84 struct regular : poly_base<poly_regular_interface, poly_regular_instance>
85 {
87 
91  template <typename T>
92  explicit regular(const T& s)
93  : base_t(s) { }
94 
96  : base_t(empty_t()) { }
97 
102  : base_t(move_from<base_t>(x.source)) {}
103 
104 };
105 
106 
107 /*************************************************************************************************/
108 
109 #if !defined(ADOBE_NO_DOCUMENTATION)
110 
111 /*************************************************************************************************/
112 
113 typedef poly<regular> poly_regular_t;
114 
115 /*************************************************************************************************/
116 
117 #endif
118 
119 /*************************************************************************************************/
120 
121 } // namespace adobe
122 
123 /*************************************************************************************************/
124 
125 #endif
poly_base< poly_regular_interface, poly_regular_instance > base_t
optimized_storage_type< T, poly_regular_interface >::type base_t
An empty regular- and less-than-comparable- type.
Definition: empty.hpp:49
move_from is used for move_ctors.
Definition: move.hpp:306
bool equals(const poly_regular_interface &x) const
Virtual interface for RegularConcept. Used in poly implementation.
virtual bool equals(const poly_regular_interface &new_value) const =0
Authors of a Concept representative F, intended as a template parameter to adobe::poly, will inherit from adobe::poly_base. The first template parameter for adobe::poly_base provides the virtual interface for the concept representative. The second template parameter for adobe::poly_base must inherit from the Concept interface representative. The author's third duty is to provide forwarding functions in a their Concept representative. See the placeable_concept.hpp header file for details.
Definition: poly.hpp:259
regular(move_from< regular > x)
BOOST_CLASS_REQUIRE(T, adobe, RegularConcept)
Abstract interface providing signatures needed to implement "handle" objects modeling a Value (Copyab...
Definition: poly.hpp:66
regular(const T &s)
Authors of adobe::poly concept representatives must derive their instance class from this...
Definition: poly.hpp:238
"Handle" class used in poly implementation.
Implementation of a trivial poly interface in terms of types modeling regular . Used in poly...
poly_regular_instance(move_from< poly_regular_instance > x)
virtual const std::type_info & type_info() const =0

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