git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@40 331e1502-861f-0410-8da2-ba01fb791d7f
76 lines
5.2 KiB
HTML
76 lines
5.2 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: 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 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> / <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 <utils/eoStat.h></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><PyEO>
|
|
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<PyEO></a>& pop)
|
|
00015 {
|
|
00016 call_method<void>(<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><PyEO>
|
|
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<const PyEO*>& pop)
|
|
00027 {
|
|
00028 call_method<void>(<span class="keyword">self</span>, <span class="stringliteral">"__call__"</span>, boost::ref(pop));
|
|
00029 }
|
|
00030 };
|
|
00031
|
|
00032 <span class="keyword">typedef</span> std::vector<const PyEO*> eoPopView;
|
|
00033
|
|
00034 <span class="keyword">const</span> PyEO& popview_getitem(<span class="keyword">const</span> std::vector<const PyEO*>& pop, <span class="keywordtype">int</span> it)
|
|
00035 {
|
|
00036 <span class="keywordtype">unsigned</span> item = unsigned(it);
|
|
00037 <span class="keywordflow">if</span> (item > 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_<eoStatBase<PyEO>, StatBaseWrapper, boost::noncopyable>
|
|
00046 (<span class="stringliteral">"eoStatBase"</span>, init<>())
|
|
00047 .def(<span class="stringliteral">"lastCall"</span>, &<a class="code" href="classeo_stat_base.html">eoStatBase<PyEO></a>::lastCall)
|
|
00048 .def(<span class="stringliteral">"__call__"</span>, &StatBaseWrapper::operator())
|
|
00049 ;
|
|
00050
|
|
00051 class_< eoPopView >(<span class="stringliteral">"eoPopView"</span>)
|
|
00052 .def(<span class="stringliteral">"__getitem__"</span>, popview_getitem, return_internal_reference<>() )
|
|
00053 .def(<span class="stringliteral">"__len__"</span>, &eoPopView::size)
|
|
00054 ;
|
|
00055
|
|
00056 class_<eoSortedStatBase<PyEO>, SortedStatBaseWrapper, boost::noncopyable>
|
|
00057 (<span class="stringliteral">"eoSortedStatBase"</span>, init<>())
|
|
00058 .def(<span class="stringliteral">"lastCall"</span>, &<a class="code" href="classeo_sorted_stat_base.html">eoSortedStatBase<PyEO></a>::lastCall)
|
|
00059 .def(<span class="stringliteral">"__call__"</span>, &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
|
|
<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>
|