Changeset 651 for library/doc/html/config2mxstruct_8h_source.html
- Timestamp:
- 10/12/09 13:49:39 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/doc/html/config2mxstruct_8h_source.html
r641 r651 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 3 <title>mixpp: config2mxstruct.h Source File</title> 6 <link href="tabs.css" rel="stylesheet" type="text/css"/> 7 <link href="doxygen.css" rel="stylesheet" type="text/css"/> 8 </head> 9 <body> 10 <!-- Generated by Doxygen 1.6.1 --> 4 <link href="tabs.css" rel="stylesheet" type="text/css"> 5 <link href="doxygen.css" rel="stylesheet" type="text/css"> 6 </head><body> 7 <!-- Generated by Doxygen 1.5.9 --> 11 8 <script type="text/javascript"> 12 9 <!-- … … 68 65 <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CFGSTR_H</span> 69 66 <a name="l00003"></a>00003 <span class="preprocessor"></span> 70 <a name="l00004"></a>00004 <span class="preprocessor">#include "../base/libconfig/libconfig.h++"</span>67 <a name="l00004"></a>00004 <span class="preprocessor">#include "../base/libconfig/libconfig.h++"</span> 71 68 <a name="l00005"></a>00005 <span class="preprocessor">#include <itpp/itbase.h></span> 72 69 <a name="l00006"></a>00006 <span class="preprocessor">#include <itpp/itmex.h></span> … … 79 76 <a name="l00014"></a><a class="code" href="classUImxConfig.html">00014</a> <span class="keyword">class </span><a class="code" href="classUImxConfig.html" title="Reimplementation of libconfig&#39;s Config class for Matlab mxArray structures.">UImxConfig</a> : <span class="keyword">public</span> Config { 80 77 <a name="l00015"></a>00015 <span class="keyword">public</span>: 81 <a name="l00017"></a><a class="code" href="classUImxConfig.html# accf378aab12b7709d644441fd2e30d00">00017</a> mxArray *<a class="code" href="classUImxConfig.html#accf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a>;82 <a name="l00019"></a><a class="code" href="classUImxConfig.html# a412edc44fdc05586fcda662c27692630">00019</a> <a class="code" href="classUImxConfig.html#a412edc44fdc05586fcda662c27692630" title="Load file in libconfig syntax to Matlab arrays.">UImxConfig</a> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * filename ) {78 <a name="l00017"></a><a class="code" href="classUImxConfig.html#ccf378aab12b7709d644441fd2e30d00">00017</a> mxArray *<a class="code" href="classUImxConfig.html#ccf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a>; 79 <a name="l00019"></a><a class="code" href="classUImxConfig.html#412edc44fdc05586fcda662c27692630">00019</a> <a class="code" href="classUImxConfig.html#412edc44fdc05586fcda662c27692630" title="Load file in libconfig syntax to Matlab arrays.">UImxConfig</a> ( <span class="keyword">const</span> <span class="keywordtype">char</span> * filename ) { 83 80 <a name="l00020"></a>00020 Config config; 84 81 <a name="l00021"></a>00021 config.readFile ( filename ); 85 <a name="l00022"></a>00022 <a class="code" href="classUImxConfig.html# accf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a> = group2mxstruct ( config.getRoot() );82 <a name="l00022"></a>00022 <a class="code" href="classUImxConfig.html#ccf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a> = group2mxstruct ( config.getRoot() ); 86 83 <a name="l00023"></a>00023 } 87 <a name="l00025"></a><a class="code" href="classUImxConfig.html# a324906cf1f31cab56ead72a512a16861">00025</a> <a class="code" href="classUImxConfig.html#a324906cf1f31cab56ead72a512a16861" title="Convert existing Setting to Matlab arrays.">UImxConfig</a> ( <span class="keyword">const</span> Setting &setting ) {88 <a name="l00026"></a>00026 <a class="code" href="classUImxConfig.html# accf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a> = group2mxstruct ( setting );84 <a name="l00025"></a><a class="code" href="classUImxConfig.html#324906cf1f31cab56ead72a512a16861">00025</a> <a class="code" href="classUImxConfig.html#324906cf1f31cab56ead72a512a16861" title="Convert existing Setting to Matlab arrays.">UImxConfig</a> ( <span class="keyword">const</span> Setting &setting ) { 85 <a name="l00026"></a>00026 <a class="code" href="classUImxConfig.html#ccf378aab12b7709d644441fd2e30d00" title="Matlab structure where the info is stored.">mxconfig</a> = group2mxstruct ( setting ); 89 86 <a name="l00027"></a>00027 } 90 87 <a name="l00028"></a>00028 91 88 <a name="l00029"></a>00029 <span class="keyword">private</span>: 92 89 <a name="l00031"></a>00031 mxArray* array2mxvector ( <span class="keyword">const</span> Setting &setting ) { 93 <a name="l00032"></a>00032 <span class="keywordflow">if</span> ( !setting.isArray() ) mexErrMsgTxt ( <span class="stringliteral"> "Given setting is not an array"</span> );90 <a name="l00032"></a>00032 <span class="keywordflow">if</span> ( !setting.isArray() ) mexErrMsgTxt ( <span class="stringliteral">"Given setting is not an array"</span> ); 94 91 <a name="l00033"></a>00033 <span class="keywordtype">double</span> *elements = <span class="keyword">new</span> <span class="keywordtype">double</span>[setting.getLength() ]; 95 92 <a name="l00034"></a>00034 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < setting.getLength(); i++ ) { … … 109 106 <a name="l00048"></a>00048 110 107 <a name="l00050"></a>00050 mxArray* list2mxmatrix ( <span class="keyword">const</span> Setting &setting ) { 111 <a name="l00051"></a>00051 <span class="keywordflow">if</span> ( !setting.isList() || ( <span class="stringliteral"> "matrix"</span> != setting[0] ) )112 <a name="l00052"></a>00052 mexErrMsgTxt ( <span class="stringliteral"> "Given setting is not a matrix"</span> );108 <a name="l00051"></a>00051 <span class="keywordflow">if</span> ( !setting.isList() || ( <span class="stringliteral">"matrix"</span> != setting[0] ) ) 109 <a name="l00052"></a>00052 mexErrMsgTxt ( <span class="stringliteral">"Given setting is not a matrix"</span> ); 113 110 <a name="l00053"></a>00053 <span class="keywordtype">int</span> rows = setting[1]; 114 111 <a name="l00054"></a>00054 <span class="keywordtype">int</span> cols = setting[2]; 115 112 <a name="l00055"></a>00055 <span class="keywordflow">if</span> ( setting[3].getLength() != rows*cols ) 116 <a name="l00056"></a>00056 mexErrMsgTxt ( <span class="stringliteral"> "Matrix elements do not fit to rows*cols"</span> );113 <a name="l00056"></a>00056 mexErrMsgTxt ( <span class="stringliteral">"Matrix elements do not fit to rows*cols"</span> ); 117 114 <a name="l00057"></a>00057 <span class="keywordtype">double</span> *elements = <span class="keyword">new</span> <span class="keywordtype">double</span>[rows*cols]; 118 115 <a name="l00058"></a>00058 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < rows*cols; i++ ) { … … 128 125 <a name="l00068"></a>00068 129 126 <a name="l00070"></a>00070 mxArray* group2mxstruct ( <span class="keyword">const</span> Setting &setting ) { 130 <a name="l00071"></a>00071 <span class="keywordflow">if</span> ( !setting.isGroup() ) mexErrMsgTxt ( <span class="stringliteral"> "Given setting is not a group."</span> );127 <a name="l00071"></a>00071 <span class="keywordflow">if</span> ( !setting.isGroup() ) mexErrMsgTxt ( <span class="stringliteral">"Given setting is not a group."</span> ); 131 128 <a name="l00072"></a>00072 <span class="keyword">const</span> <span class="keywordtype">char</span> ** keys = <span class="keyword">new</span> <span class="keyword">const</span> <span class="keywordtype">char</span>*[setting.getLength() ]; 132 129 <a name="l00073"></a>00073 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < setting.getLength(); i++ ) { … … 164 161 <a name="l00105"></a>00105 <span class="keywordflow">default</span>: 165 162 <a name="l00106"></a>00106 <span class="comment">//this should never happen</span> 166 <a name="l00107"></a>00107 mexErrMsgTxt ( <span class="stringliteral"> "Unknown type of a setting."</span> );163 <a name="l00107"></a>00107 mexErrMsgTxt ( <span class="stringliteral">"Unknown type of a setting."</span> ); 167 164 <a name="l00108"></a>00108 } 168 165 <a name="l00109"></a>00109 } … … 171 168 <a name="l00112"></a>00112 } 172 169 <a name="l00114"></a>00114 mxArray* list2mxcell ( <span class="keyword">const</span> Setting &setting ) { 173 <a name="l00115"></a>00115 <span class="keywordflow">if</span> ( !setting.isList() ) mexErrMsgTxt ( <span class="stringliteral"> "Given setting is not a list."</span> );170 <a name="l00115"></a>00115 <span class="keywordflow">if</span> ( !setting.isList() ) mexErrMsgTxt ( <span class="stringliteral">"Given setting is not a list."</span> ); 174 171 <a name="l00116"></a>00116 <span class="keywordflow">if</span> ( setting.getLength() == 0 ) { 175 172 <a name="l00117"></a>00117 mxArray *result = mxCreateCellMatrix ( 1, 0 ); 176 173 <a name="l00118"></a>00118 <span class="keywordflow">return</span> result; 177 174 <a name="l00119"></a>00119 } 178 <a name="l00120"></a>00120 <span class="keywordflow">if</span> ( ( setting[0].getType() == Setting::TypeString ) && ( <span class="stringliteral"> "matrix"</span> == setting[0] ) ) {175 <a name="l00120"></a>00120 <span class="keywordflow">if</span> ( ( setting[0].getType() == Setting::TypeString ) && ( <span class="stringliteral">"matrix"</span> == setting[0] ) ) { 179 176 <a name="l00121"></a>00121 <span class="keywordflow">return</span> list2mxmatrix ( setting ); 180 177 <a name="l00122"></a>00122 } … … 209 206 <a name="l00151"></a>00151 <span class="keywordflow">default</span>: 210 207 <a name="l00152"></a>00152 <span class="comment">//this should never happen</span> 211 <a name="l00153"></a>00153 mexErrMsgTxt ( <span class="stringliteral"> "Unknown type of a setting."</span> );208 <a name="l00153"></a>00153 mexErrMsgTxt ( <span class="stringliteral">"Unknown type of a setting."</span> ); 212 209 <a name="l00154"></a>00154 } 213 210 <a name="l00155"></a>00155 } … … 218 215 <a name="l00160"></a>00160 <span class="preprocessor">#endif //CFGSTR_H</span> 219 216 </pre></div></div> 220 <hr size="1" /><address style="text-align: right;"><small>Generated on Sun Sep 27 00:49:042009 for mixpp by 217 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 17:34:42 2009 for mixpp by 221 218 <a href="http://www.doxygen.org/index.html"> 222 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1</small></address>219 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> 223 220 </body> 224 221 </html>