Paradiseo-eo sources added

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2006-12-12 14:49:08 +00:00
commit c3aec878e5
3609 changed files with 342772 additions and 0 deletions

View file

@ -0,0 +1,76 @@
<!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: statistics.cpp 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&nbsp;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&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<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>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">pyeo</a></div>
<h1>statistics.cpp</h1><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#include &lt;utils/eoStat.h&gt;</span>
00002
00003 <span class="preprocessor">#include "PyEO.h"</span>
00004 <span class="preprocessor">#include "valueParam.h"</span>
00005
00006 <span class="keyword">using</span> <span class="keyword">namespace </span>boost::python;
00007
00008 <span class="keyword">class </span>StatBaseWrapper : <span class="keyword">public</span> <a class="code" href="classeo_stat_base.html">eoStatBase</a>&lt;PyEO&gt;
00009 {
00010 <span class="keyword">public</span>:
00011 PyObject* <span class="keyword">self</span>;
00012 StatBaseWrapper(PyObject* p) : self(p) {}
00013
00014 <span class="keywordtype">void</span> <a class="code" href="classeo_u_f.html#a1">operator()</a>(<span class="keyword">const</span> <a class="code" href="classeo_pop.html">eoPop&lt;PyEO&gt;</a>&amp; pop)
00015 {
00016 call_method&lt;void&gt;(<span class="keyword">self</span>, <span class="stringliteral">"__call__"</span>, boost::ref(pop));
00017 }
00018 };
00019
00020 <span class="keyword">class </span>SortedStatBaseWrapper : <span class="keyword">public</span> <a class="code" href="classeo_sorted_stat_base.html">eoSortedStatBase</a>&lt;PyEO&gt;
00021 {
00022 <span class="keyword">public</span>:
00023 PyObject* <span class="keyword">self</span>;
00024 SortedStatBaseWrapper(PyObject* p) : self(p) {}
00025
00026 <span class="keywordtype">void</span> <a class="code" href="classeo_u_f.html#a1">operator()</a>(<span class="keyword">const</span> std::vector&lt;const PyEO*&gt;&amp; pop)
00027 {
00028 call_method&lt;void&gt;(<span class="keyword">self</span>, <span class="stringliteral">"__call__"</span>, boost::ref(pop));
00029 }
00030 };
00031
00032 <span class="keyword">typedef</span> std::vector&lt;const PyEO*&gt; eoPopView;
00033
00034 <span class="keyword">const</span> PyEO&amp; popview_getitem(<span class="keyword">const</span> std::vector&lt;const PyEO*&gt;&amp; pop, <span class="keywordtype">int</span> it)
00035 {
00036 <span class="keywordtype">unsigned</span> item = unsigned(it);
00037 <span class="keywordflow">if</span> (item &gt; pop.size())
00038 <span class="keywordflow">throw</span> index_error(<span class="stringliteral">"too much"</span>);
00039
00040 <span class="keywordflow">return</span> *pop[item];
00041 }
00042
00043 <span class="keywordtype">void</span> statistics()
00044 {
00045 class_&lt;eoStatBase&lt;PyEO&gt;, StatBaseWrapper, boost::noncopyable&gt;
00046 (<span class="stringliteral">"eoStatBase"</span>, init&lt;&gt;())
00047 .def(<span class="stringliteral">"lastCall"</span>, &amp;<a class="code" href="classeo_stat_base.html">eoStatBase&lt;PyEO&gt;</a>::lastCall)
00048 .def(<span class="stringliteral">"__call__"</span>, &amp;StatBaseWrapper::operator())
00049 ;
00050
00051 class_&lt; eoPopView &gt;(<span class="stringliteral">"eoPopView"</span>)
00052 .def(<span class="stringliteral">"__getitem__"</span>, popview_getitem, return_internal_reference&lt;&gt;() )
00053 .def(<span class="stringliteral">"__len__"</span>, &amp;eoPopView::size)
00054 ;
00055
00056 class_&lt;eoSortedStatBase&lt;PyEO&gt;, SortedStatBaseWrapper, boost::noncopyable&gt;
00057 (<span class="stringliteral">"eoSortedStatBase"</span>, init&lt;&gt;())
00058 .def(<span class="stringliteral">"lastCall"</span>, &amp;<a class="code" href="classeo_sorted_stat_base.html">eoSortedStatBase&lt;PyEO&gt;</a>::lastCall)
00059 .def(<span class="stringliteral">"__call__"</span>, &amp;SortedStatBaseWrapper::operator())
00060 ;
00061 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Thu Oct 19 05:06:42 2006 for EO by&nbsp;
<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>