1<?xml version="1.0" ?> 2<!-- 3 Copyright 2010 Eric Niebler 4 5 Distributed under the Boost 6 Software License, Version 1.0. (See accompanying 7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 --> 9<concept name="Domain" category="utility"> 10 <param name="Domain" role="domain-type" /> 11 <param name="Expr" role="expression-type" /> 12 <param name="Object" role="object-type" /> 13 14 <models-sentence> 15 The type <arg num="1" /> must be a model of <self/>. It also 16 models Unary Polymorphic Function. 17 </models-sentence> 18 19 <models-sentence> 20 The type <arg num="2" /> must be a model of <conceptname>Expr</conceptname> 21 </models-sentence> 22 23 <description> 24 <para> 25 A Domain creates an association between expressions and a so-called 26 generator, which is a function that maps an expression in the default 27 domain to an equivalent expression in this Domain. It also associates 28 an expression with a grammar, to which all expressions within this 29 Domain must conform. 30 </para> 31 </description> 32 33 <notation variables="d"> 34 <sample-value> 35 <type name="Domain" /> 36 </sample-value> 37 </notation> 38 39 <notation variables="e"> 40 <sample-value> 41 <type name="Expr" /> 42 </sample-value> 43 </notation> 44 45 <notation variables="o"> 46 <sample-value> 47 <type name="Object" /> 48 </sample-value> 49 </notation> 50 51 <associated-type name="proto_grammar"> 52 <get-member-type name="proto_grammar"> 53 <type name="Domain"/> 54 </get-member-type> 55 <description> 56 <simpara>The grammar to which every expression in this Domain 57 must conform.</simpara> 58 </description> 59 </associated-type> 60 61 <associated-type name="proto_generator"> 62 <get-member-type name="proto_generator"> 63 <type name="Domain"/> 64 </get-member-type> 65 <description> 66 <simpara> 67 A Unary Polymorphic Function that accepts expressions in the 68 default domain and emits expressions in this Domain. 69 </simpara> 70 </description> 71 </associated-type> 72 73 <associated-type name="proto_super_domain"> 74 <get-member-type name="proto_super_domain"> 75 <type name="Domain"/> 76 </get-member-type> 77 <description> 78 <simpara> 79 The Domain that is a super-domain of this domain, if 80 any such domain exists. If not, it is some unspecified 81 type. 82 </simpara> 83 </description> 84 </associated-type> 85 86 <associated-type name="result_type"> 87 <get-member-type name="type"> 88 <apply-template name="boost::result_of"> 89 <type name="Domain(Expr)"/> 90 </apply-template> 91 </get-member-type> 92 <description> 93 <simpara> 94 The type of the result of applying 95 <computeroutput>proto_generator</computeroutput> to 96 the specified expression type. The result is required to 97 model <conceptname>Expr</conceptname>. The domain type 98 associated with <computeroutput>result_type</computeroutput> 99 (<computeroutput>result_type::proto_domain</computeroutput>) 100 is required to be the same type as this Domain. 101 </simpara> 102 </description> 103 </associated-type> 104 105 <associated-type name="as_expr_result_type"> 106 <get-member-type name="result_type"> 107 <apply-template name="Domain::as_expr"> 108 <type name="Object"/> 109 </apply-template> 110 </get-member-type> 111 <description> 112 <simpara> 113 The result of converting some type to a Proto expression 114 type in this domain. This is used, for instance, when 115 calculating the type of a variable to hold a Proto 116 expression. 117 <computeroutput>as_expr_result_type</computeroutput> 118 models 119 <computeroutput><conceptname>Expr</conceptname></computeroutput>. 120 </simpara> 121 </description> 122 </associated-type> 123 124 <associated-type name="as_child_result_type"> 125 <get-member-type name="result_type"> 126 <apply-template name="Domain::as_child"> 127 <type name="Object"/> 128 </apply-template> 129 </get-member-type> 130 <description> 131 <simpara> 132 The result of converting some type to a Proto expression 133 type in this domain. This is used, for instance, to 134 compute the type of an object suitable for storage 135 as a child in an expression tree. 136 <computeroutput>as_child_result_type</computeroutput> 137 models 138 <computeroutput><conceptname>Expr</conceptname></computeroutput>. 139 </simpara> 140 </description> 141 </associated-type> 142 143 <valid-expression name="Apply Generator"> 144 <apply-function name="d"> 145 <sample-value> 146 <type name="Expr"/> 147 </sample-value> 148 </apply-function> 149 <return-type> 150 <require-same-type testable="yes"> 151 <type name="result_type"/> 152 </require-same-type> 153 </return-type> 154 <semantics> 155 The result of applying <computeroutput>proto_generator</computeroutput> 156 to the specified expression. 157 </semantics> 158 </valid-expression> 159 160 <valid-expression name="As Expression"> 161 <apply-function name="Domain::as_expr< Object >()"> 162 <sample-value> 163 <type name="Object"/> 164 </sample-value> 165 </apply-function> 166 <return-type> 167 <require-same-type testable="yes"> 168 <type name="as_expr_result_type"/> 169 </require-same-type> 170 </return-type> 171 <semantics> 172 The result of converting some object to a Proto expression 173 in this domain. It returns a Proto expression object that 174 is suitable for storage in a variable. It should return a 175 new object, which may be a copy of the object passed in. 176 </semantics> 177 </valid-expression> 178 179 <valid-expression name="As Child"> 180 <apply-function name="Domain::as_child< Object >()"> 181 <sample-value> 182 <type name="Object"/> 183 </sample-value> 184 </apply-function> 185 <return-type> 186 <require-same-type testable="yes"> 187 <type name="as_child_result_type"/> 188 </require-same-type> 189 </return-type> 190 <semantics> 191 The result of converting some object to a Proto expression 192 in this domain. It returns an object suitable for storage 193 as a child in an expression tree, which may simply be a 194 reference to the object passed in. 195 </semantics> 196 </valid-expression> 197 198 <example-model> 199 <type name="boost::proto::default_domain" /> 200 </example-model> 201 202</concept> 203