<?xml version="1.0" encoding="utf-8"?>
<header name="boost/proto/transform/call.hpp">
  <para>Contains definition of the call&lt;&gt; transform. </para>
  <namespace name="boost">
    <namespace name="proto">
      <struct name="call">
        <template>
          <template-type-parameter name="T"/>
        </template>
        <purpose>Make the given <conceptname>Transform</conceptname> into a <conceptname>PrimitiveTransform</conceptname>.</purpose>

        <description>
          <para>
            The purpose of <computeroutput>proto::call&lt;&gt;</computeroutput> is to annotate a transform as callable
            so that <computeroutput><classname alt="proto::when">proto::when&lt;&gt;</classname></computeroutput> knows
            how to apply it. The template parameter must be either a <conceptname>PrimitiveTransform</conceptname> or a
            <conceptname>CallableTransform</conceptname>; that is, a function type for which the return type is a callable
            <conceptname>PolymorphicFunctionObject</conceptname>.
          </para>

          <para>
            For the complete description of the behavior of the <computeroutput>proto::call&lt;&gt;</computeroutput>
            transform, see the documentation for the nested
            <computeroutput>
              <classname alt="proto::call::impl">proto::call::impl&lt;&gt;</classname>
            </computeroutput>
            class template.
          </para>
        </description>

        <inherit><type><classname>proto::transform</classname>&lt; call&lt;T&gt; &gt;</type></inherit>

        <struct name="impl">
          <template>
            <template-type-parameter name="Expr"/>
            <template-type-parameter name="State"/>
            <template-type-parameter name="Data"/>
          </template>
          <inherit><type><classname>proto::transform_impl&lt;Expr, State, Data&gt;</classname></type></inherit>
          <typedef name="result_type">
            <type><replaceable>see-below</replaceable></type>
            <description>
              <para>
                <computeroutput>proto::call&lt;T&gt;::impl&lt;Expr,State,Data&gt;::result_type</computeroutput>
                is computed as follows:
                <itemizedlist>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> if of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname></computeroutput> or
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>()</computeroutput>, then
                      <computeroutput>result_type</computeroutput> is:
                      <programlisting>typename boost::result_of&lt;PrimitiveTransform(Expr, State, Data)&gt;::type</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0)</computeroutput>, then
                      <computeroutput>result_type</computeroutput> is:
                      <programlisting>typename boost::result_of&lt;PrimitiveTransform(
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T0&gt;(Expr, State, Data)&gt;::type,
  State, 
  Data
)&gt;::type</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0, T1)</computeroutput>, then
                      <computeroutput>result_type</computeroutput> is:
                      <programlisting>typename boost::result_of&lt;PrimitiveTransform(
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T0&gt;(Expr, State, Data)&gt;::type,
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T1&gt;(Expr, State, Data)&gt;::type,
  Data
)&gt;::type</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0, T1, T2)</computeroutput>, then
                      <computeroutput>result_type</computeroutput> is:
                      <programlisting>typename boost::result_of&lt;PrimitiveTransform(
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T0&gt;(Expr, State, Data)&gt;::type,
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T1&gt;(Expr, State, Data)&gt;::type,
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T2&gt;(Expr, State, Data)&gt;::type
)&gt;::type</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(T0,...TN)</computeroutput>, then
                      <computeroutput>result_type</computeroutput> is:
                      <programlisting>typename boost::result_of&lt;PolymorphicFunctionObject(
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,T0&gt;(Expr, State, Data)&gt;::type,
  ...
  typename boost::result_of&lt;<classname>when</classname>&lt;<classname>_</classname>,TN&gt;(Expr, State, Data)&gt;::type
&gt;::type</programlisting>
                    </para>
                  </listitem>
                </itemizedlist>
              </para>
            </description>
          </typedef>
          <method-group name="public member functions">
            <method name="operator()" cv="const">
              <type>result_type</type>
              <parameter name="expr">
                <paramtype>typename impl::expr_param</paramtype>
              </parameter>
              <parameter name="state">
                <paramtype>typename impl::state_param</paramtype>
              </parameter>
              <parameter name="data">
                <paramtype>typename impl::data_param</paramtype>
              </parameter>
              <description>
              <para>
                <computeroutput>proto::call&lt;T&gt;::impl&lt;Expr,State,Data&gt;::operator()</computeroutput> behaves as follows:
                <itemizedlist>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> if of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname></computeroutput> or
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>()</computeroutput>, then
                      return
                      <programlisting>PrimitiveTransform()(expr, state, data)</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0)</computeroutput>, then
                      return
                      <programlisting>PrimitiveTransform()(
  <classname>when</classname>&lt;<classname>_</classname>,T0&gt;()(expr, state, data),
  state, 
  sata
)</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0, T1)</computeroutput>, then
                      return:
                      <programlisting>PrimitiveTransform()(
  <classname>when</classname>&lt;<classname>_</classname>,T0&gt;()(expr, state, data),
  <classname>when</classname>&lt;<classname>_</classname>,T1&gt;()(expr, state, data),
  Data
)</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PrimitiveTransform</conceptname>(T0, T1, T2)</computeroutput>, then
                      return
                      <programlisting>PrimitiveTransform()(
  <classname>when</classname>&lt;<classname>_</classname>,T0&gt;()(expr, state, data),
  <classname>when</classname>&lt;<classname>_</classname>,T1&gt;()(expr, state, data),
  <classname>when</classname>&lt;<classname>_</classname>,T2&gt;()(expr, state, data)
)</programlisting>
                    </para>
                  </listitem>
                  <listitem>
                    <para>
                      If <computeroutput>T</computeroutput> is of the form
                      <computeroutput><conceptname>PolymorphicFunctionObject</conceptname>(T0,...TN)</computeroutput>, then
                      return:
                      <programlisting>PolymorphicFunctionObject()(
  <classname>when</classname>&lt;<classname>_</classname>,T0&gt;()(expr, state, data),
  ...
  <classname>when</classname>&lt;<classname>_</classname>,TN&gt;()(expr, state, data)
)</programlisting>
                    </para>
                  </listitem>
                </itemizedlist>
              </para>
              </description>
            </method>
          </method-group>
        </struct>
      </struct>
    </namespace>
  </namespace>
</header>
