Domain.xml 6.2 KB

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