git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
142 lines
12 KiB
HTML
142 lines
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>EO: eoCounter.h Source File</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.3.9.1 -->
|
|
<div class="qindex"> <form class="search" action="search.php" method="get">
|
|
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
|
|
<div class="nav">
|
|
<a class="el" href="dir_000000.html">src</a></div>
|
|
<h1>eoCounter.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-</span>
|
|
00002
|
|
00003 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00004 <span class="comment">// eoCounter.h</span>
|
|
00005 <span class="comment">// (c) Maarten Keijzer 2000</span>
|
|
00006 <span class="comment">/* </span>
|
|
00007 <span class="comment"> This library is free software; you can redistribute it and/or</span>
|
|
00008 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span>
|
|
00009 <span class="comment"> License as published by the Free Software Foundation; either</span>
|
|
00010 <span class="comment"> version 2 of the License, or (at your option) any later version.</span>
|
|
00011 <span class="comment"></span>
|
|
00012 <span class="comment"> This library is distributed in the hope that it will be useful,</span>
|
|
00013 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
|
00014 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
|
|
00015 <span class="comment"> Lesser General Public License for more details.</span>
|
|
00016 <span class="comment"></span>
|
|
00017 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span>
|
|
00018 <span class="comment"> License along with this library; if not, write to the Free Software</span>
|
|
00019 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
|
|
00020 <span class="comment"></span>
|
|
00021 <span class="comment"> Contact: todos@geneura.ugr.es, http://geneura.ugr.es</span>
|
|
00022 <span class="comment"> mak@dhi.dk</span>
|
|
00023 <span class="comment"> */</span>
|
|
00024 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00025
|
|
00026 <span class="preprocessor">#ifndef _eoCounter_h</span>
|
|
00027 <span class="preprocessor"></span><span class="preprocessor">#define _eoCounter_h</span>
|
|
00028 <span class="preprocessor"></span>
|
|
00029 <span class="preprocessor">#include <eoFunctor.h></span>
|
|
00030 <span class="preprocessor">#include <eoFunctorStore.h></span>
|
|
00031 <span class="preprocessor">#include <utils/eoParam.h></span>
|
|
00032
|
|
00040 <span class="keyword">template</span> <<span class="keyword">class</span> Procedure>
|
|
<a name="l00041"></a><a class="code" href="classeo_procedure_counter.html">00041</a> <span class="keyword">class </span><a class="code" href="classeo_procedure_counter.html">eoProcedureCounter</a> : <span class="keyword">public</span> Procedure, <span class="keyword">public</span> <a class="code" href="classeo_value_param.html">eoValueParam</a><unsigned long>
|
|
00042 {
|
|
00043 <span class="keyword">public</span>:
|
|
00044
|
|
00045 <a class="code" href="classeo_procedure_counter.html">eoProcedureCounter</a>(Procedure& _proc, std::string _name = <span class="stringliteral">"proc_counter"</span>)
|
|
00046 : <a class="code" href="classeo_value_param.html">eoValueParam<unsigned long></a>(0, _name), proc(_proc) {}
|
|
00047
|
|
<a name="l00064"></a><a class="code" href="classeo_procedure_counter.html#a1">00064</a> <span class="keyword">typename</span> Procedure::result_type <a class="code" href="classeo_procedure_counter.html#a1">operator()</a>(<span class="keywordtype">void</span>)
|
|
00065 {
|
|
00066 <a class="code" href="classeo_value_param.html#a2">value</a>()++;
|
|
00067 <span class="preprocessor">#ifdef _MSC_VER</span>
|
|
00068 <span class="preprocessor"></span> proc();
|
|
00069 <span class="preprocessor">#else</span>
|
|
00070 <span class="preprocessor"></span> <span class="keywordflow">return</span> proc();
|
|
00071 <span class="preprocessor">#endif</span>
|
|
00072 <span class="preprocessor"></span> }
|
|
00073
|
|
00074 <span class="keyword">private</span> :
|
|
00075
|
|
00076 Procedure& proc;
|
|
00077 };
|
|
00078
|
|
00094 <span class="keyword">template</span> <<span class="keyword">class</span> UnaryFunctor>
|
|
<a name="l00095"></a><a class="code" href="classeo_unary_functor_counter.html">00095</a> <span class="keyword">class </span><a class="code" href="classeo_unary_functor_counter.html">eoUnaryFunctorCounter</a> : <span class="keyword">public</span> UnaryFunctor, <span class="keyword">public</span> <a class="code" href="classeo_value_param.html">eoValueParam</a><unsigned long>
|
|
00096 {
|
|
00097 <span class="keyword">public</span>:
|
|
00098 <a class="code" href="classeo_unary_functor_counter.html">eoUnaryFunctorCounter</a>(UnaryFunctor& _func, std::string _name = <span class="stringliteral">"uf_counter"</span>)
|
|
00099 : <a class="code" href="classeo_value_param.html">eoValueParam<unsigned long></a>(0, _name), func(_func) {}
|
|
00100
|
|
00117 <span class="keyword">typename</span> UnaryFunctor::result_type <span class="keyword">operator</span>()
|
|
<a name="l00118"></a><a class="code" href="classeo_unary_functor_counter.html#a1">00118</a> (<span class="keyword">typename</span> UnaryFunctor::first_argument_type _arg1)
|
|
00119 {
|
|
00120 <a class="code" href="classeo_value_param.html#a2">value</a>()++;
|
|
00121 <span class="preprocessor">#ifdef _MSC_VER</span>
|
|
00122 <span class="preprocessor"></span> func(_arg1);
|
|
00123 <span class="preprocessor">#else</span>
|
|
00124 <span class="preprocessor"></span> <span class="keywordflow">return</span> func(_arg1);
|
|
00125 <span class="preprocessor">#endif</span>
|
|
00126 <span class="preprocessor"></span> }
|
|
00127
|
|
00128 <span class="keyword">private</span> :
|
|
00129
|
|
00130 UnaryFunctor& func;
|
|
00131 };
|
|
00132
|
|
00141 <span class="keyword">template</span> <<span class="keyword">class</span> BinaryFunctor>
|
|
<a name="l00142"></a><a class="code" href="classeo_binary_functor_counter.html">00142</a> <span class="keyword">class </span><a class="code" href="classeo_binary_functor_counter.html">eoBinaryFunctorCounter</a> : <span class="keyword">public</span> BinaryFunctor, <span class="keyword">public</span> <a class="code" href="classeo_value_param.html">eoValueParam</a><unsigned long>
|
|
00143 {
|
|
00144 <span class="keyword">public</span>:
|
|
00145 <a class="code" href="classeo_binary_functor_counter.html">eoBinaryFunctorCounter</a>(BinaryFunctor& _func, std::string _name = <span class="stringliteral">"proc_counter"</span>)
|
|
00146 : <a class="code" href="classeo_value_param.html">eoValueParam<unsigned long></a>(0, _name), func(_func) {}
|
|
00147
|
|
00165 <span class="keyword">typename</span> BinaryFunctor::result_type <span class="keyword">operator</span>()
|
|
<a name="l00166"></a><a class="code" href="classeo_binary_functor_counter.html#a1">00166</a> (<span class="keyword">typename</span> BinaryFunctor::first_argument_type _arg1,
|
|
00167 <span class="keyword">typename</span> BinaryFunctor::second_argument_type _arg2)
|
|
00168 {
|
|
00169 <a class="code" href="classeo_value_param.html#a2">value</a>()++;
|
|
00170 <span class="preprocessor">#ifdef _MSC_VER</span>
|
|
00171 <span class="preprocessor"></span> func(_arg1, _arg2);
|
|
00172 <span class="preprocessor">#else</span>
|
|
00173 <span class="preprocessor"></span> <span class="keywordflow">return</span> func(_arg1, _arg2);
|
|
00174 <span class="preprocessor">#endif</span>
|
|
00175 <span class="preprocessor"></span> }
|
|
00176
|
|
00177 <span class="keyword">private</span> :
|
|
00178
|
|
00179 BinaryFunctor& func;
|
|
00180 };
|
|
00181
|
|
00195 <span class="keyword">template</span> <<span class="keyword">class</span> Procedure>
|
|
00196 <a class="code" href="classeo_procedure_counter.html">eoProcedureCounter<Procedure></a>& make_counter(<a class="code" href="structeo_functor_base_1_1procedure__tag.html">eoFunctorBase::procedure_tag</a>, Procedure& _proc, <a class="code" href="classeo_functor_store.html">eoFunctorStore</a>& store, std::string _name = <span class="stringliteral">"proc_counter"</span>)
|
|
00197 {
|
|
00198 <a class="code" href="classeo_procedure_counter.html">eoProcedureCounter<Procedure></a>* result = <span class="keyword">new</span> <a class="code" href="classeo_procedure_counter.html">eoProcedureCounter<Procedure></a>(_proc, _name);
|
|
00199 store.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(result);
|
|
00200 <span class="keywordflow">return</span> *result;
|
|
00201 }
|
|
00202
|
|
00203 <span class="keyword">template</span> <<span class="keyword">class</span> UnaryFunctor>
|
|
00204 <a class="code" href="classeo_unary_functor_counter.html">eoUnaryFunctorCounter<UnaryFunctor></a>& make_counter(<a class="code" href="structeo_functor_base_1_1unary__function__tag.html">eoFunctorBase::unary_function_tag</a>, UnaryFunctor& _proc, <a class="code" href="classeo_functor_store.html">eoFunctorStore</a>& store, std::string _name = <span class="stringliteral">"uf_counter"</span>)
|
|
00205 {
|
|
00206 <a class="code" href="classeo_unary_functor_counter.html">eoUnaryFunctorCounter<UnaryFunctor></a>* result = <span class="keyword">new</span> <a class="code" href="classeo_unary_functor_counter.html">eoUnaryFunctorCounter<UnaryFunctor></a>(_proc, _name);
|
|
00207 store.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(result);
|
|
00208 <span class="keywordflow">return</span> *result;
|
|
00209 }
|
|
00210
|
|
00211 <span class="keyword">template</span> <<span class="keyword">class</span> BinaryFunctor>
|
|
00212 <a class="code" href="classeo_binary_functor_counter.html">eoBinaryFunctorCounter<BinaryFunctor></a>& make_counter(<a class="code" href="structeo_functor_base_1_1binary__function__tag.html">eoFunctorBase::binary_function_tag</a>, BinaryFunctor& _proc, <a class="code" href="classeo_functor_store.html">eoFunctorStore</a>& store, std::string _name = <span class="stringliteral">"uf_counter"</span>)
|
|
00213 {
|
|
00214 <a class="code" href="classeo_binary_functor_counter.html">eoBinaryFunctorCounter<BinaryFunctor></a>* result = <span class="keyword">new</span> <a class="code" href="classeo_binary_functor_counter.html">eoBinaryFunctorCounter<BinaryFunctor></a>(_proc, _name);
|
|
00215 store.<a class="code" href="classeo_functor_store.html#a2">storeFunctor</a>(result);
|
|
00216 <span class="keywordflow">return</span> *result;
|
|
00217 }
|
|
00218
|
|
00219 <span class="preprocessor">#endif</span>
|
|
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:34 2006 for EO by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address>
|
|
</body>
|
|
</html>
|