• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>NaryGenerator</title>
5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../../index.html" title="Spirit 2.5.8">
8<link rel="up" href="../generator_concepts.html" title="Generator Concepts">
9<link rel="prev" href="binarygenerator.html" title="BinaryGenerator">
10<link rel="next" href="nonterminal.html" title="Nonterminal">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="binarygenerator.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../generator_concepts.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="nonterminal.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="spirit.karma.reference.generator_concepts.narygenerator"></a><a class="link" href="narygenerator.html" title="NaryGenerator">NaryGenerator</a>
28</h5></div></div></div>
29<h6>
30<a name="spirit.karma.reference.generator_concepts.narygenerator.h0"></a>
31            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.description"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.description">Description</a>
32          </h6>
33<p>
34            <span class="emphasis"><em>NaryGenerator</em></span> is a composite generator that has
35            one or more subjects. The NaryGenerator allows its subjects to be treated
36            in the same way as a single instance of a <a class="link" href="generator.html" title="Generator"><code class="computeroutput"><span class="identifier">Generator</span></code></a> following the Composite
37            Design Pattern.
38          </p>
39<h6>
40<a name="spirit.karma.reference.generator_concepts.narygenerator.h1"></a>
41            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.refinement_of"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.refinement_of">Refinement
42            of</a>
43          </h6>
44<div class="blockquote"><blockquote class="blockquote"><p>
45              <a class="link" href="generator.html" title="Generator"><code class="computeroutput"><span class="identifier">Generator</span></code></a>
46            </p></blockquote></div>
47<div class="variablelist">
48<p class="title"><b>Notation</b></p>
49<dl class="variablelist">
50<dt><span class="term"><code class="computeroutput"><span class="identifier">g</span></code></span></dt>
51<dd><p>
52                  A NaryGenerator.
53                </p></dd>
54<dt><span class="term"><code class="computeroutput"><span class="identifier">G</span></code></span></dt>
55<dd><p>
56                  A NaryGenerator type.
57                </p></dd>
58</dl>
59</div>
60<h6>
61<a name="spirit.karma.reference.generator_concepts.narygenerator.h2"></a>
62            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.valid_expressions"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.valid_expressions">Valid
63            Expressions</a>
64          </h6>
65<p>
66            In addition to the requirements defined in <a class="link" href="generator.html" title="Generator"><code class="computeroutput"><span class="identifier">Generator</span></code></a>, for any NaryGenerator
67            the following must be met:
68          </p>
69<div class="informaltable"><table class="table">
70<colgroup>
71<col>
72<col>
73<col>
74</colgroup>
75<thead><tr>
76<th>
77                    <p>
78                      Expression
79                    </p>
80                  </th>
81<th>
82                    <p>
83                      Semantics
84                    </p>
85                  </th>
86<th>
87                    <p>
88                      Return type
89                    </p>
90                  </th>
91</tr></thead>
92<tbody><tr>
93<td>
94                    <p>
95                      <code class="computeroutput"><span class="identifier">g</span><span class="special">.</span><span class="identifier">elements</span></code>
96                    </p>
97                  </td>
98<td>
99                    <p>
100                      The tuple of elements.
101                    </p>
102                  </td>
103<td>
104                    <p>
105                      A <a href="../../../../../../../../libs/fusion/doc/html/index.html" target="_top">Boost.Fusion</a>
106                      Sequence of <a class="link" href="generator.html" title="Generator"><code class="computeroutput"><span class="identifier">Generator</span></code></a> types.
107                    </p>
108                  </td>
109</tr></tbody>
110</table></div>
111<h6>
112<a name="spirit.karma.reference.generator_concepts.narygenerator.h3"></a>
113            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.type_expressions"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.type_expressions">Type
114            Expressions</a>
115          </h6>
116<div class="informaltable"><table class="table">
117<colgroup>
118<col>
119<col>
120</colgroup>
121<thead><tr>
122<th>
123                    <p>
124                      Expression
125                    </p>
126                  </th>
127<th>
128                    <p>
129                      Description
130                    </p>
131                  </th>
132</tr></thead>
133<tbody>
134<tr>
135<td>
136                    <p>
137                      <code class="computeroutput"><span class="identifier">g</span><span class="special">.</span><span class="identifier">elements_type</span></code>
138                    </p>
139                  </td>
140<td>
141                    <p>
142                      Elements tuple type.
143                    </p>
144                  </td>
145</tr>
146<tr>
147<td>
148                    <p>
149                      <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">is_nary_generator</span><span class="special">&lt;</span><span class="identifier">G</span><span class="special">&gt;::</span><span class="identifier">type</span></code>
150                    </p>
151                  </td>
152<td>
153                    <p>
154                      Metafunction that evaluates to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code>
155                      if a certain type, <code class="computeroutput"><span class="identifier">G</span></code>
156                      is a NaryGenerator, <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code>
157                      otherwise (See <a href="../../../../../../../../libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL
158                      Boolean Constant</a>).
159                    </p>
160                  </td>
161</tr>
162</tbody>
163</table></div>
164<h6>
165<a name="spirit.karma.reference.generator_concepts.narygenerator.h4"></a>
166            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.invariants"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.invariants">Invariants</a>
167          </h6>
168<p>
169            For each element, <code class="computeroutput"><span class="identifier">E</span></code>,
170            in any NaryGenerator, <code class="computeroutput"><span class="identifier">G</span></code>,
171            the following invariant always holds:
172          </p>
173<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
174                <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">is_generator</span><span class="special">&lt;</span><span class="identifier">E</span><span class="special">&gt;::</span><span class="identifier">type</span></code> evaluates to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code>
175              </li></ul></div>
176<h6>
177<a name="spirit.karma.reference.generator_concepts.narygenerator.h5"></a>
178            <span class="phrase"><a name="spirit.karma.reference.generator_concepts.narygenerator.models"></a></span><a class="link" href="narygenerator.html#spirit.karma.reference.generator_concepts.narygenerator.models">Models</a>
179          </h6>
180<p>
181            The following generators conform to this model:
182          </p>
183<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
184<li class="listitem">
185                <a class="link" href="../operator/sequence.html" title="Sequence Generator (a &lt;&lt; b)">Sequence
186                (<code class="computeroutput"><span class="special">&lt;&lt;</span></code>)</a>,
187              </li>
188<li class="listitem">
189                <a class="link" href="../operator/alternative.html" title="Alternative Generator (a | b)">Alternative
190                (<code class="computeroutput"><span class="special">|</span></code>)</a>.
191              </li>
192</ul></div>
193<p>
194            <span class="bold"><strong>FIXME</strong></span> Add more links to models of NaryGenerator
195            concept
196          </p>
197</div>
198<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
199<td align="left"></td>
200<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
201        Distributed under the Boost Software License, Version 1.0. (See accompanying
202        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
203      </p>
204</div></td>
205</tr></table>
206<hr>
207<div class="spirit-nav">
208<a accesskey="p" href="binarygenerator.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../generator_concepts.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="nonterminal.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
209</div>
210</body>
211</html>
212