blob: 12eb5566c89aefde078e90df19451adc1cff237b [file] [log] [blame]
<!-- Copyright 2008 Lubomir Bourdev and Hailin Jin
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<!--
Copyright 2005-2007 Adobe Systems Incorporated
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
or a copy at http://stlab.adobe.com/licenses.html)
Some files are held under additional license.
Please see "http://stlab.adobe.com/licenses.html" for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<TITLE>Generic Image Library: apply_operation_base.hpp File Reference</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
<LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" style='width: 100%; margin: 0; padding: 0'><tr>
<td width="100%" valign="top" style='padding-left: 10px; padding-right: 10px; padding-bottom: 10px'>
<div class="qindex"><a class="qindex" href="index.html">Modules</a>
| <a class="qindex" href="classes.html">Alphabetical List</a>
| <a class="qindex" href="annotated.html">Class List</a>
| <a class="qindex" href="dirs.html">Directories</a>
| <a class="qindex" href="files.html">File List</a>
| <a class="qindex" href="../index.html">GIL Home Page</a>
</div>
<!-- End Header -->
<!-- Generated by Doxygen 1.5.6 -->
<div class="navpath"><a class="el" href="g_i_l_0076.html">boost</a>&nbsp;&raquo&nbsp;<a class="el" href="g_i_l_0079.html">gil</a>&nbsp;&raquo&nbsp;<a class="el" href="g_i_l_0078.html">extension</a>&nbsp;&raquo&nbsp;<a class="el" href="g_i_l_0075.html">dynamic_image</a>
</div>
<div class="contents">
<h1>apply_operation_base.hpp File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Given an object with run-time specified type (denoted as an array of Bits, dynamic index, and a static set of Types) and a generic operation, casts the object to its appropriate type and applies the operation.
<p>
<dl class="author" compact><dt><b>Author:</b></dt><dd>Lubomir Bourdev and Hailin Jin <br>
Adobe Systems Incorporated </dd></dl>
<dl class="date" compact><dt><b>Date:</b></dt><dd>2005-2007 <br>
Last updated on November 6, 2007 </dd></dl>
<p>
<code>#include &quot;<a class="el" href="g_i_l_0093.html">../../gil_config.hpp</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="g_i_l_0642.html">../../utilities.hpp</a>&quot;</code><br>
<code>#include &lt;boost/mpl/begin.hpp&gt;</code><br>
<code>#include &lt;boost/mpl/next.hpp&gt;</code><br>
<code>#include &lt;boost/mpl/deref.hpp&gt;</code><br>
<code>#include &lt;boost/mpl/size.hpp&gt;</code><br>
<code>#include &lt;boost/preprocessor/repeat.hpp&gt;</code><br>
<p>
<a href="g_i_l_0007.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost.html">boost</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><b>boost::gil</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><b>boost::gil::detail</b></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d79b83cac67b5b966b9d5b66aa122460"></a><!-- doxytag: member="apply_operation_base.hpp::GIL_FWD_TYPEDEFS" ref="d79b83cac67b5b966b9d5b66aa122460" args="(z, N, text)" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>GIL_FWD_TYPEDEFS</b>(z, N, text)&nbsp;&nbsp;&nbsp;T##N; typedef typename mpl::next&lt;T##N&gt;::type</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2b5c77543f4d9130526fed67ac7464ee"></a><!-- doxytag: member="apply_operation_base.hpp::GIL_FWD_CASE" ref="2b5c77543f4d9130526fed67ac7464ee" args="(z, N, SUM)" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>GIL_FWD_CASE</b>(z, N, SUM)&nbsp;&nbsp;&nbsp;case N: return op(*gil_reinterpret_cast&lt;typename mpl::deref&lt;T##N&gt;::type*&gt;(&amp;bits));</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9aeac994894106449bcde0806b254df9"></a><!-- doxytag: member="apply_operation_base.hpp::GIL_FWD_CONST_CASE" ref="9aeac994894106449bcde0806b254df9" args="(z, N, SUM)" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>GIL_FWD_CONST_CASE</b>(z, N, SUM)&nbsp;&nbsp;&nbsp;case N: return op(*gil_reinterpret_cast_c&lt;const typename mpl::deref&lt;T##N&gt;::type*&gt;(&amp;bits));</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>GIL_APPLY_FWD_OP</b>(z, N, text)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8dee41b11d92b34295f54281a098ae90"></a><!-- doxytag: member="apply_operation_base.hpp::GIL_GENERATE_APPLY_FWD_OPS" ref="8dee41b11d92b34295f54281a098ae90" args="(N)" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>GIL_GENERATE_APPLY_FWD_OPS</b>(N)&nbsp;&nbsp;&nbsp;BOOST_PP_REPEAT(N, GIL_APPLY_FWD_OP, BOOST_PP_EMPTY)</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="e7eaa4c36cc9636e1b2f97184c35636a"></a><!-- doxytag: member="apply_operation_base.hpp::apply_operation_basec" ref="e7eaa4c36cc9636e1b2f97184c35636a" args="(const Bits &amp;bits, std::size_t index, Op op)" -->
template&lt;typename Types, typename Bits, typename Op&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">Op::result_type GIL_FORCEINLINE&nbsp;</td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_basec</b> (const Bits &amp;bits, std::size_t index, Op op)</td></tr>
<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="d771ee58462b8590bccbd0950c9b58d4"></a><!-- doxytag: member="apply_operation_base.hpp::apply_operation_base" ref="d771ee58462b8590bccbd0950c9b58d4" args="(Bits &amp;bits, std::size_t index, Op op)" -->
template&lt;typename Types, typename Bits, typename Op&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">Op::result_type GIL_FORCEINLINE&nbsp;</td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_base</b> (Bits &amp;bits, std::size_t index, Op op)</td></tr>
<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="40a9fc96031783e58fa0e39a08d2c5a4"></a><!-- doxytag: member="apply_operation_base.hpp::apply_operation_base" ref="40a9fc96031783e58fa0e39a08d2c5a4" args="(const Bits1 &amp;bits1, std::size_t index1, const Bits2 &amp;bits2, std::size_t index2, Op op)" -->
template&lt;typename Types1, typename Types2, typename Bits1, typename Bits2, typename Op&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static Op::result_type <br>
GIL_FORCEINLINE&nbsp;</td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_base</b> (const Bits1 &amp;bits1, std::size_t index1, const Bits2 &amp;bits2, std::size_t index2, Op op)</td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="97e41768b29fa4d0c910608e9243ec8f"></a><!-- doxytag: member="apply_operation_base.hpp::GIL_APPLY_FWD_OP" ref="97e41768b29fa4d0c910608e9243ec8f" args="(z, N, text)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define GIL_APPLY_FWD_OP </td>
<td>(</td>
<td class="paramtype">z, <tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">N, <tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">text&nbsp;</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keyword">template</span> &lt;&gt; <span class="keyword">struct </span>apply_operation_fwd_fn&lt;BOOST_PP_ADD(N,1)&gt; { \
<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Types, <span class="keyword">typename</span> Bits, <span class="keyword">typename</span> UnaryOp&gt; \
<span class="keyword">typename</span> UnaryOp::result_type apply(Bits&amp; bits, std::size_t index, UnaryOp op)<span class="keyword"> const </span>{ \
<span class="keyword">typedef</span> <span class="keyword">typename</span> mpl::begin&lt;Types&gt;::type \
BOOST_PP_REPEAT(N, GIL_FWD_TYPEDEFS, BOOST_PP_EMPTY) \
T##N; \
<span class="keywordflow">switch</span> (index) { \
BOOST_PP_REPEAT(BOOST_PP_ADD(N,1), GIL_FWD_CASE, BOOST_PP_EMPTY) \
} \
<span class="keywordflow">throw</span>; \
} \
<span class="keyword">template</span> &lt;<span class="keyword">typename</span> Types, <span class="keyword">typename</span> Bits, <span class="keyword">typename</span> UnaryOp&gt; \
<span class="keyword">typename</span> UnaryOp::result_type applyc(<span class="keyword">const</span> Bits&amp; bits, std::size_t index, UnaryOp op)<span class="keyword"> const </span>{ \
<span class="keyword">typedef</span> <span class="keyword">typename</span> mpl::begin&lt;Types&gt;::type \
BOOST_PP_REPEAT(N, GIL_FWD_TYPEDEFS, BOOST_PP_EMPTY) \
T##N; \
<span class="keywordflow">switch</span> (index) { \
BOOST_PP_REPEAT(BOOST_PP_ADD(N,1), GIL_FWD_CONST_CASE,BOOST_PP_EMPTY) \
} \
<span class="keywordflow">throw</span>; \
} \
};
</pre></div>
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat May 2 13:50:15 2009 for Generic Image Library by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>