<!-- 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> » <a class="el" href="g_i_l_0079.html">gil</a> » <a class="el" href="g_i_l_0078.html">extension</a> » <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 "<a class="el" href="g_i_l_0093.html">../../gil_config.hpp</a>"</code><br> <code>#include "<a class="el" href="g_i_l_0642.html">../../utilities.hpp</a>"</code><br> <code>#include <boost/mpl/begin.hpp></code><br> <code>#include <boost/mpl/next.hpp></code><br> <code>#include <boost/mpl/deref.hpp></code><br> <code>#include <boost/mpl/size.hpp></code><br> <code>#include <boost/preprocessor/repeat.hpp></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 </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 </td><td class="memItemRight" valign="bottom"><b>boost::gil</b></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">namespace </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 </td><td class="memItemRight" valign="bottom"><b>GIL_FWD_TYPEDEFS</b>(z, N, text) T##N; typedef typename mpl::next<T##N>::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 </td><td class="memItemRight" valign="bottom"><b>GIL_FWD_CASE</b>(z, N, SUM) case N: return op(*gil_reinterpret_cast<typename mpl::deref<T##N>::type*>(&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 </td><td class="memItemRight" valign="bottom"><b>GIL_FWD_CONST_CASE</b>(z, N, SUM) case N: return op(*gil_reinterpret_cast_c<const typename mpl::deref<T##N>::type*>(&bits));</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </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 </td><td class="memItemRight" valign="bottom"><b>GIL_GENERATE_APPLY_FWD_OPS</b>(N) 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 &bits, std::size_t index, Op op)" --> template<typename Types, typename Bits, typename Op> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">Op::result_type GIL_FORCEINLINE </td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_basec</b> (const Bits &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 &bits, std::size_t index, Op op)" --> template<typename Types, typename Bits, typename Op> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">Op::result_type GIL_FORCEINLINE </td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_base</b> (Bits &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 &bits1, std::size_t index1, const Bits2 &bits2, std::size_t index2, Op op)" --> template<typename Types1, typename Types2, typename Bits1, typename Bits2, typename Op> </td></tr> <tr><td class="memTemplItemLeft" nowrap align="right" valign="top">static Op::result_type <br> GIL_FORCEINLINE </td><td class="memTemplItemRight" valign="bottom"><b>apply_operation_base</b> (const Bits1 &bits1, std::size_t index1, const Bits2 &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 </td> <td class="paramname"> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> <b>Value:</b><div class="fragment"><pre class="fragment"><span class="keyword">template</span> <> <span class="keyword">struct </span>apply_operation_fwd_fn<BOOST_PP_ADD(N,1)> { \ <span class="keyword">template</span> <<span class="keyword">typename</span> Types, <span class="keyword">typename</span> Bits, <span class="keyword">typename</span> UnaryOp> \ <span class="keyword">typename</span> UnaryOp::result_type apply(Bits& bits, std::size_t index, UnaryOp op)<span class="keyword"> const </span>{ \ <span class="keyword">typedef</span> <span class="keyword">typename</span> mpl::begin<Types>::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> <<span class="keyword">typename</span> Types, <span class="keyword">typename</span> Bits, <span class="keyword">typename</span> UnaryOp> \ <span class="keyword">typename</span> UnaryOp::result_type applyc(<span class="keyword">const</span> Bits& bits, std::size_t index, UnaryOp op)<span class="keyword"> const </span>{ \ <span class="keyword">typedef</span> <span class="keyword">typename</span> mpl::begin<Types>::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 <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>