<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>HippoDraw Class Library</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> <link rel="shortcut icon" href="hippoApp.ico"> </head><body> <!-- Generated by Doxygen 1.6.2 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_def71da3bddda44674e9e2d37979faa1.html">numarray</a> </div> </div> <div class="contents"> <h1>NumArrayTuple.cxx</h1><a href="NumArrayTuple_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00012"></a>00012 <span class="comment">// include first to avoid _POSIX_C_SOURCE warning.</span> <a name="l00013"></a>00013 <span class="preprocessor">#include <boost/python.hpp></span> <a name="l00014"></a>00014 <a name="l00015"></a>00015 <span class="comment">// for have numarray etc</span> <a name="l00016"></a>00016 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span> <a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include "config.h"</span> <a name="l00018"></a>00018 <span class="preprocessor">#endif</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a><a class="code" href="NumArrayTuple_8cxx.html#a7d399fcbebb74300921248d831d6ab6f">00020</a> <span class="preprocessor">#define PY_ARRAY_UNIQUE_SYMBOL HippoPyArrayHandle</span> <a name="l00021"></a><a class="code" href="NumArrayTuple_8cxx.html#ad2cd12e09a08db7cbcae2e74f723d6c4">00021</a> <span class="preprocessor"></span><span class="preprocessor">#define NO_IMPORT_ARRAY</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="NumArrayTuple_8h.html" title="hippodraw::NumArrayTuple class interface.">NumArrayTuple.h</a>"</span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="Range_8h.html" title="hippodraw::Range class interface">axes/Range.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="num__util_8h.html">num_util.h</a>"</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#include <algorithm></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <stdexcept></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="keyword">using namespace </span>boost::python; <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keyword">using</span> std::runtime_error; <a name="l00035"></a>00035 <span class="keyword">using</span> std::string; <a name="l00036"></a>00036 <span class="keyword">using</span> std::vector; <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">using namespace </span>hippodraw; <a name="l00039"></a>00039 <a name="l00040"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a0d85d36dd54b0697e9085c226a75c3b7">00040</a> NumArrayTuple::NumArrayTuple () <a name="l00041"></a>00041 : <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> () <a name="l00042"></a>00042 { <a name="l00043"></a>00043 } <a name="l00044"></a>00044 <a name="l00045"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a318695c333e5e39d168df8d3e01b5dc2">00045</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a318695c333e5e39d168df8d3e01b5dc2" title="The destructor.">NumArrayTuple::~NumArrayTuple</a>() <a name="l00046"></a>00046 { <a name="l00047"></a>00047 } <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keywordtype">void</span> <a name="l00050"></a>00050 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#af8f91713f705756ba9c469bddce042d4" title="Raises exception because with this release making a copy is not supported.">NumArrayTuple::</a> <a name="l00051"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#af8f91713f705756ba9c469bddce042d4">00051</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#af8f91713f705756ba9c469bddce042d4" title="Raises exception because with this release making a copy is not supported.">copy</a> ( <span class="keyword">const</span> <a class="code" href="classhippodraw_1_1DataSource.html" title="Base class for DataSource.">DataSource</a> & ) <a name="l00052"></a>00052 { <a name="l00053"></a>00053 assert ( <span class="keyword">false</span> ); <a name="l00054"></a>00054 } <a name="l00055"></a>00055 <a name="l00056"></a>00056 <span class="keywordtype">void</span> <a name="l00057"></a>00057 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a22405609eb7094686259b6a82ad8e0cc" title="Notifies observers.">NumArrayTuple::</a> <a name="l00058"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a22405609eb7094686259b6a82ad8e0cc">00058</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a22405609eb7094686259b6a82ad8e0cc" title="Notifies observers.">notifyObservers</a> ( )<span class="keyword"> const</span> <a name="l00059"></a>00059 <span class="keyword"></span>{ <a name="l00060"></a>00060 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a22405609eb7094686259b6a82ad8e0cc" title="Notifies observers.">Observable::notifyObservers</a> (); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a name="l00064"></a>00064 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b" title="Returns the size of the slice for the next to last dimension.">NumArrayTuple::</a> <a name="l00065"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b">00065</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b" title="Returns the size of the slice for the next to last dimension.">rows</a>()<span class="keyword"> const</span> <a name="l00066"></a>00066 <span class="keyword"></span>{ <a name="l00067"></a>00067 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = 0; <a name="l00068"></a>00068 <a name="l00069"></a>00069 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.empty () == false ) { <a name="l00070"></a>00070 numeric::array na = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">getNumArray</a> ( 0 ); <a name="l00071"></a>00071 size = static_cast < <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> > ( <a class="code" href="namespacenum__util.html#a1ef5e293536c0e817f7e1ee745a44f75" title="Returns the size of a specific dimension.">num_util::get_dim</a> ( na, 0 ) ); <a name="l00072"></a>00072 } <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="keywordflow">return</span> size; <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a name="l00077"></a>00077 <span class="keywordtype">bool</span> <a name="l00078"></a>00078 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac6e61de369e994009e36f344f99c15ad" title="Returns true, if NumArrayTuple is empty, i.e.">NumArrayTuple::</a> <a name="l00079"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac6e61de369e994009e36f344f99c15ad">00079</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac6e61de369e994009e36f344f99c15ad" title="Returns true, if NumArrayTuple is empty, i.e.">empty</a> ()<span class="keyword"> const</span> <a name="l00080"></a>00080 <span class="keyword"></span>{ <a name="l00081"></a>00081 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b" title="Returns the size of the slice for the next to last dimension.">rows</a> () == 0; <a name="l00082"></a>00082 } <a name="l00083"></a>00083 <a name="l00087"></a>00087 <span class="keywordtype">double</span> <a name="l00088"></a>00088 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6d02cb85b64865574b5e442cbce44df1">NumArrayTuple::</a> <a name="l00089"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6d02cb85b64865574b5e442cbce44df1">00089</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6d02cb85b64865574b5e442cbce44df1">valueAt</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> row, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )<span class="keyword"> const</span> <a name="l00090"></a>00090 <span class="keyword"></span>{ <a name="l00091"></a>00091 <span class="preprocessor">#if HAVE_NUMPY || HAVE_NUMERIC</span> <a name="l00092"></a>00092 <span class="preprocessor"></span> PyGILState_STATE state = PyGILState_Ensure (); <a name="l00093"></a>00093 <span class="preprocessor">#endif</span> <a name="l00094"></a>00094 <span class="preprocessor"></span> <a name="l00095"></a>00095 assert ( column < <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.size () ); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="keyword">const</span> numeric::array array = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>[column]; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">num_util::size</a> ( array ); <a name="l00100"></a>00100 assert ( row < static_cast < unsigned int > ( size ) ); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="keywordtype">object</span> result = array[row]; <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordtype">double</span> value = extract < double > ( result ); <a name="l00105"></a>00105 <span class="preprocessor">#if HAVE_NUMPY || HAVE_NUMERIC</span> <a name="l00106"></a>00106 <span class="preprocessor"></span> PyGILState_Release ( state ); <a name="l00107"></a>00107 <span class="preprocessor">#endif</span> <a name="l00108"></a>00108 <span class="preprocessor"></span> <a name="l00109"></a>00109 <span class="keywordflow">return</span> value; <a name="l00110"></a>00110 } <a name="l00111"></a>00111 <a name="l00115"></a>00115 <span class="keyword">const</span> std::vector < double > & <a name="l00116"></a>00116 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6810ce28ceb1ff3d729b2c3c9e771fb7" title="Returns a const reference to slice along the axis known as a row.">NumArrayTuple::</a> <a name="l00117"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6810ce28ceb1ff3d729b2c3c9e771fb7">00117</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6810ce28ceb1ff3d729b2c3c9e771fb7" title="Returns a const reference to slice along the axis known as a row.">getRow</a> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> row )<span class="keyword"> const</span> <a name="l00118"></a>00118 <span class="keyword"></span>{ <a name="l00119"></a>00119 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.size(); <a name="l00120"></a>00120 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a93acb7a0d94f9e3e9cc46c1392d89ba0" title="A temporary array of data from one row of each column.">m_row</a>.resize ( size ); <a name="l00121"></a>00121 <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> = 0; <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> < size; <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a>++ ) { <a name="l00122"></a>00122 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a93acb7a0d94f9e3e9cc46c1392d89ba0" title="A temporary array of data from one row of each column.">m_row</a> [ <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> ] = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6d02cb85b64865574b5e442cbce44df1">valueAt</a> ( row, <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> ); <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a93acb7a0d94f9e3e9cc46c1392d89ba0" title="A temporary array of data from one row of each column.">m_row</a>; <a name="l00126"></a>00126 } <a name="l00127"></a>00127 <a name="l00130"></a>00130 <span class="keywordtype">int</span> <a name="l00131"></a>00131 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a3819df12544a637523c37c05b7b24f76" title="Adds a column to the end of the NumArrayTuple.">NumArrayTuple::</a> <a name="l00132"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a3819df12544a637523c37c05b7b24f76">00132</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a3819df12544a637523c37c05b7b24f76" title="Adds a column to the end of the NumArrayTuple.">addColumn</a> ( <span class="keyword">const</span> std::string & label, <a name="l00133"></a>00133 boost::python::numeric::array array ) <a name="l00134"></a>00134 { <a name="l00135"></a>00135 <span class="comment">// Check if label already exists.</span> <a name="l00136"></a>00136 <span class="keywordtype">int</span> index = <a class="code" href="classhippodraw_1_1DataSource.html#aa26d6f6aa00fc1486dd69069f5f9d90b" title="Returns true if the specified column labeled label has been filled.">indexOf</a> ( label ); <a name="l00137"></a>00137 <span class="keywordflow">if</span> ( index >= 0 ) { <a name="l00138"></a>00138 <span class="keywordtype">string</span> what ( <span class="stringliteral">"NumArrayTuple Attempt to add a column whose label, `"</span>); <a name="l00139"></a>00139 what += label; <a name="l00140"></a>00140 what += <span class="stringliteral">"', is same as existing column."</span>; <a name="l00141"></a>00141 <span class="keywordflow">throw</span> runtime_error ( what ); <a name="l00142"></a>00142 } <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> new_size = <a class="code" href="namespacenum__util.html#a1ef5e293536c0e817f7e1ee745a44f75" title="Returns the size of a specific dimension.">num_util::get_dim</a> ( array, 0 ); <a name="l00145"></a>00145 <span class="comment">// Check if column has right size.</span> <a name="l00146"></a>00146 <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.empty () == false ) { <a name="l00147"></a>00147 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> old_size = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a2b76a8f13ad489df9fa8cc9452c9012b" title="Returns the size of the slice for the next to last dimension.">rows</a> (); <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="keywordflow">if</span> ( old_size != 0 && old_size != new_size ) { <a name="l00150"></a>00150 <span class="keywordtype">string</span> what ( <span class="stringliteral">"NumArrayTuple Attempt to add a column whose size"</span> <a name="l00151"></a>00151 <span class="stringliteral">" is not equal to other columns."</span> ); <a name="l00152"></a>00152 <span class="keywordflow">throw</span> runtime_error ( what ); <a name="l00153"></a>00153 } <a name="l00154"></a>00154 } <a name="l00155"></a>00155 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.push_back ( array ); <a name="l00156"></a>00156 <a class="code" href="classhippodraw_1_1DataSource.html#ab1f473e6b1fcc052680a9d0cb241167e" title="Adds a new label for a column.">addLabel</a> ( label ); <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>.size() - 1; <a name="l00159"></a>00159 } <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordtype">void</span> <a name="l00162"></a>00162 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd" title="Replaces the column indexed by index with the array.">NumArrayTuple::</a> <a name="l00163"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd">00163</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd" title="Replaces the column indexed by index with the array.">replaceColumn</a> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> col, <a name="l00164"></a>00164 boost::python::numeric::array array ) <a name="l00165"></a>00165 { <a name="l00166"></a>00166 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = <a class="code" href="classhippodraw_1_1DataSource.html#a903d6ffef3ddea0d904a5336e231b643" title="Returns the number of columns or data arrays available from this DataSource.">columns</a> (); <a name="l00167"></a>00167 <span class="keywordflow">if</span> ( col >= size ) { <a name="l00168"></a>00168 <span class="keyword">const</span> <span class="keywordtype">string</span> what ( <span class="stringliteral">"NunArrayTuple: column doesn't exist"</span> ); <a name="l00169"></a>00169 <span class="keywordflow">throw</span> runtime_error ( what ); <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="keyword">const</span> numeric::array old_array = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>[col]; <a name="l00173"></a>00173 <span class="keywordtype">int</span> old_size = <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">num_util::size</a> ( old_array ); <a name="l00174"></a>00174 <span class="keywordtype">int</span> new_size = <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">num_util::size</a> ( array ); <a name="l00175"></a>00175 <a name="l00176"></a>00176 <span class="keywordflow">if</span> ( old_size != 0 && old_size != new_size ) { <a name="l00177"></a>00177 <span class="keyword">const</span> <span class="keywordtype">string</span> what ( <span class="stringliteral">"NumArrayTuple: Attempt to replace column with one "</span> <a name="l00178"></a>00178 <span class="stringliteral">"whose size is not equal to other columns."</span> ); <a name="l00179"></a>00179 <span class="keywordflow">throw</span> runtime_error ( what ); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>[col] = array; <a name="l00182"></a>00182 <a name="l00183"></a>00183 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a22405609eb7094686259b6a82ad8e0cc" title="Notifies observers.">notifyObservers</a> (); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 <a name="l00186"></a>00186 <span class="keywordtype">void</span> <a name="l00187"></a>00187 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd" title="Replaces the column indexed by index with the array.">NumArrayTuple::</a> <a name="l00188"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#ad3f3cfaae6aabde411d1dccfd30dbef5">00188</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd" title="Replaces the column indexed by index with the array.">replaceColumn</a> ( <span class="keyword">const</span> std::string & <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a>, <a name="l00189"></a>00189 boost::python::numeric::array array ) <a name="l00190"></a>00190 { <a name="l00191"></a>00191 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = <a class="code" href="classhippodraw_1_1DataSource.html#aa26d6f6aa00fc1486dd69069f5f9d90b" title="Returns true if the specified column labeled label has been filled.">indexOf</a> ( column ); <a name="l00192"></a>00192 <a name="l00193"></a>00193 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a635bb26070528124f48d9d670dfb87bd" title="Replaces the column indexed by index with the array.">replaceColumn</a> ( index, array ); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 <a name="l00196"></a>00196 numeric::array <a name="l00197"></a>00197 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">NumArrayTuple::</a> <a name="l00198"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac445cac1c15285acea4a8c00896cc0cf">00198</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">getNumArray</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index )<span class="keyword"> const</span> <a name="l00199"></a>00199 <span class="keyword"></span>{ <a name="l00200"></a>00200 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = <a class="code" href="classhippodraw_1_1DataSource.html#a903d6ffef3ddea0d904a5336e231b643" title="Returns the number of columns or data arrays available from this DataSource.">columns</a> (); <a name="l00201"></a>00201 <span class="keywordflow">if</span> ( index >= size ) { <a name="l00202"></a>00202 <span class="keyword">const</span> <span class="keywordtype">string</span> what ( <span class="stringliteral">"NunArrayTuple: column doesn't exist"</span> ); <a name="l00203"></a>00203 <span class="keywordflow">throw</span> runtime_error ( what ); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a44feb2ed7d5b4f094bc43d738a620bb0" title="The numarray objects that contains the data.">m_data</a>[index]; <a name="l00206"></a>00206 } <a name="l00207"></a>00207 <a name="l00208"></a>00208 numeric::array <a name="l00209"></a>00209 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">NumArrayTuple::</a> <a name="l00210"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a">00210</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">getNumArray</a>( <span class="keyword">const</span> std::string & label )<span class="keyword"> const</span> <a name="l00211"></a>00211 <span class="keyword"></span>{ <a name="l00212"></a>00212 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = <a class="code" href="classhippodraw_1_1DataSource.html#aa26d6f6aa00fc1486dd69069f5f9d90b" title="Returns true if the specified column labeled label has been filled.">indexOf</a> ( label ); <a name="l00213"></a>00213 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">getNumArray</a>( index ); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="keywordtype">void</span> <a name="l00217"></a>00217 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6f267e1482fa1b59a3193a9b11cf32f9" title="Sets the shape of the data elements.">NumArrayTuple::</a> <a name="l00218"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6f267e1482fa1b59a3193a9b11cf32f9">00218</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a6f267e1482fa1b59a3193a9b11cf32f9" title="Sets the shape of the data elements.">setShape</a> ( std::vector < unsigned int > & <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a> ) <a name="l00219"></a>00219 { <a name="l00220"></a>00220 <a class="code" href="classhippodraw_1_1DataSource.html#a4e73e38e0edb48dacc82de939a94d46b" title="The shape of the data.">m_shape</a> = shape; <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="keyword">const</span> vector < unsigned int > & <a name="l00224"></a>00224 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac263a432c113e518030935750c65b801" title="Returns the shape of the data elements.">NumArrayTuple::</a> <a name="l00225"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac263a432c113e518030935750c65b801">00225</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac263a432c113e518030935750c65b801" title="Returns the shape of the data elements.">getShape</a> ()<span class="keyword"> const</span> <a name="l00226"></a>00226 <span class="keyword"></span>{ <a name="l00227"></a>00227 <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1DataSource.html#a4e73e38e0edb48dacc82de939a94d46b" title="The shape of the data.">m_shape</a>; <a name="l00228"></a>00228 } <a name="l00229"></a>00229 <a name="l00230"></a>00230 <span class="keywordtype">void</span> <a name="l00231"></a>00231 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a02c5e24b01c9be6cf12e4815baca5574" title="Fills the vector with the shape of a column.">NumArrayTuple::</a> <a name="l00232"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a02c5e24b01c9be6cf12e4815baca5574">00232</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a02c5e24b01c9be6cf12e4815baca5574" title="Fills the vector with the shape of a column.">fillShape</a> ( std::vector < intptr_t > & <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )<span class="keyword"> const</span> <a name="l00233"></a>00233 <span class="keyword"></span>{ <a name="l00234"></a>00234 shape.clear (); <a name="l00235"></a>00235 numeric::array na = <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a576b62321c3ec3f3726c13741135178a" title="Return the reference to the desired numarray by column label.">getNumArray</a> ( column ); <a name="l00236"></a>00236 <a name="l00237"></a>00237 shape = <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">num_util::shape</a> ( na ); <a name="l00238"></a>00238 } <a name="l00239"></a>00239 <a name="l00240"></a>00240 <span class="keywordtype">void</span> <a name="l00241"></a>00241 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac8bb3912a3ce86b15842e79d0b421204" title="Raises assertion as this method is not implemented yet.">NumArrayTuple::</a> <a name="l00242"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac8bb3912a3ce86b15842e79d0b421204">00242</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#ac8bb3912a3ce86b15842e79d0b421204" title="Raises assertion as this method is not implemented yet.">clear</a> () <a name="l00243"></a>00243 { <a name="l00244"></a>00244 assert ( <span class="keyword">false</span> ); <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <a name="l00247"></a>00247 <span class="keywordtype">void</span> <a name="l00248"></a>00248 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a595acdd9cae86ec28dd0f894833a8c0d" title="Raises assertion as this method is not implemented yet.">NumArrayTuple::</a> <a name="l00249"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#a595acdd9cae86ec28dd0f894833a8c0d">00249</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#a595acdd9cae86ec28dd0f894833a8c0d" title="Raises assertion as this method is not implemented yet.">reserve</a> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ) <span class="comment">//row )</span> <a name="l00250"></a>00250 { <a name="l00251"></a>00251 assert ( <span class="keyword">false</span> ); <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <a name="l00254"></a>00254 <span class="keywordtype">double</span> <a name="l00255"></a>00255 <a class="code" href="classhippodraw_1_1NumArrayTuple.html#acbf962bf260a39f2b3fef70abfc21422" title="Raises assertion as this method is not implemented yet.">NumArrayTuple::</a> <a name="l00256"></a><a class="code" href="classhippodraw_1_1NumArrayTuple.html#acbf962bf260a39f2b3fef70abfc21422">00256</a> <a class="code" href="classhippodraw_1_1NumArrayTuple.html#acbf962bf260a39f2b3fef70abfc21422" title="Raises assertion as this method is not implemented yet.">operator [] </a>( std::vector < unsigned int > & ) const <span class="comment">// indices ) const</span> <a name="l00257"></a>00257 { <a name="l00258"></a>00258 assert ( <span class="keyword">false</span> ); <a name="l00259"></a>00259 <span class="keywordflow">return</span> 0.; <a name="l00260"></a>00260 } </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0> </a> </small></address> </body> </html>