git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
66 lines
4.7 KiB
HTML
66 lines
4.7 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: eoDetSelect.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>eoDetSelect.h</h1><div class="fragment"><pre class="fragment">00001
|
|
00025 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00026
|
|
00027 <span class="preprocessor">#ifndef _eoDetSelect_h</span>
|
|
00028 <span class="preprocessor"></span><span class="preprocessor">#define _eoDetSelect_h</span>
|
|
00029 <span class="preprocessor"></span>
|
|
00030
|
|
00031 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00032 <span class="preprocessor">#include <eoSelect.h></span>
|
|
00033 <span class="preprocessor">#include <utils/eoHowMany.h></span>
|
|
00034 <span class="preprocessor">#include <math.h></span>
|
|
00035 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
00036
|
|
00039 <span class="keyword">template</span><<span class="keyword">class</span> EOT>
|
|
<a name="l00040"></a><a class="code" href="classeo_det_select.html">00040</a> <span class="keyword">class </span><a class="code" href="classeo_det_select.html">eoDetSelect</a> : <span class="keyword">public</span> <a class="code" href="classeo_select.html">eoSelect</a><EOT>
|
|
00041 {
|
|
00042 <span class="keyword">public</span>:
|
|
<a name="l00044"></a><a class="code" href="classeo_det_select.html#a0">00044</a> <a class="code" href="classeo_det_select.html#a0">eoDetSelect</a>(<span class="keywordtype">double</span> _rate = 1.0, <span class="keywordtype">bool</span> _interpret_as_rate = <span class="keyword">true</span>)
|
|
00045 : howMany(_rate, _interpret_as_rate) {}
|
|
00046
|
|
<a name="l00053"></a><a class="code" href="classeo_det_select.html#a1">00053</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classeo_det_select.html#a1">operator()</a>(<span class="keyword">const</span> <a class="code" href="classeo_pop.html">eoPop<EOT></a>& _source, <a class="code" href="classeo_pop.html">eoPop<EOT></a>& _dest)
|
|
00054 {
|
|
00055 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pSize = _source.size();
|
|
00056 size_t target = howMany(pSize);
|
|
00057
|
|
00058 _dest.resize(target);
|
|
00059
|
|
00060 <span class="keywordtype">unsigned</span> remain = target % pSize;
|
|
00061 <span class="keywordtype">unsigned</span> entireCopy = target / pSize;
|
|
00062 <span class="keyword">typename</span> <a class="code" href="classeo_pop.html">eoPop<EOT></a>::iterator it = _dest.begin();
|
|
00063
|
|
00064 <span class="keywordflow">if</span> (target >= pSize)
|
|
00065 {
|
|
00066 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i=0; i<entireCopy; i++)
|
|
00067 {
|
|
00068 std::copy(_source.begin(), _source.end(), it);
|
|
00069 it += pSize;
|
|
00070 }
|
|
00071 }
|
|
00072 <span class="comment">// the last ones</span>
|
|
00073 <span class="keywordflow">if</span> (remain)
|
|
00074 {
|
|
00075 std::copy(_source.begin(), _source.begin()+remain, it);
|
|
00076 }
|
|
00077 }
|
|
00078
|
|
00079 <span class="keyword">private</span> :
|
|
00080 <a class="code" href="classeo_how_many.html">eoHowMany</a> howMany;
|
|
00081 };
|
|
00082
|
|
00083 <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>
|