Changeset 354 for doc/html/uibuilder_8h-source.html
- Timestamp:
- 06/02/09 10:24:26 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
doc/html/uibuilder_8h-source.html
r353 r354 66 66 <a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define UIBUILD</span> 67 67 <a name="l00003"></a>00003 <span class="preprocessor"></span> 68 <a name="l00004"></a>00004 <span class="preprocessor">#include < <a class="code" href="itbase_8h.html" title="Include file for the IT++ base module.">itpp/itbase.h</a>></span>68 <a name="l00004"></a>00004 <span class="preprocessor">#include <itpp/itbase.h></span> 69 69 <a name="l00005"></a>00005 <span class="preprocessor">#include "<a class="code" href="libBM_8h.html" title="Bayesian Models (bm) that use Bayes rule to learn from observations.">stat/libBM.h</a>"</span> 70 70 <a name="l00006"></a>00006 <span class="preprocessor">#include "libconfig/libconfig.h++"</span> … … 89 89 <a name="l00028"></a>00028 UIFile ( <span class="keyword">const</span> <span class="keywordtype">char</span> * fname ) :Config() { 90 90 <a name="l00029"></a>00029 <span class="keywordflow">try</span>{Config::readFile ( fname );} 91 <a name="l00030"></a>00030 <span class="keywordflow">catch</span> ( FileIOException f ) { <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"File "</span> + <span class="keywordtype">string</span> ( fname ) + <span class="stringliteral">" not found"</span> );}91 <a name="l00030"></a>00030 <span class="keywordflow">catch</span> ( FileIOException f ) {it_error ( <span class="stringliteral">"File "</span> + <span class="keywordtype">string</span> ( fname ) + <span class="stringliteral">" not found"</span> );} 92 92 <a name="l00031"></a>00031 <span class="keywordflow">catch</span> ( ParseException& P ) { 93 93 <a name="l00032"></a>00032 <span class="keywordtype">char</span> msg[200]; 94 94 <a name="l00033"></a>00033 sprintf ( msg,<span class="stringliteral">"Error in file %s on line %d."</span>, fname, P.getLine() ); 95 <a name="l00034"></a>00034 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( msg );95 <a name="l00034"></a>00034 it_error ( msg ); 96 96 <a name="l00035"></a>00035 } 97 97 <a name="l00036"></a>00036 setAutoConvert(<span class="keyword">true</span>); … … 112 112 <a name="l00054"></a>00054 <span class="keywordflow">case</span> Setting::TypeBoolean : 113 113 <a name="l00055"></a>00055 vector[i]=bool ( S[i] );<span class="keywordflow">break</span>; 114 <a name="l00056"></a>00056 <span class="keywordflow">default</span>: <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"libconfig error?"</span> );114 <a name="l00056"></a>00056 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); 115 115 <a name="l00057"></a>00057 } 116 116 <a name="l00058"></a>00058 } … … 119 119 <a name="l00061"></a>00061 <span class="keywordtype">int</span> cols = S[<span class="stringliteral">"cols"</span>]; 120 120 <a name="l00062"></a>00062 <span class="keywordflow">if</span> (vector.length() != cols) { 121 <a name="l00063"></a>00063 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>(<span class="stringliteral">"requested vector is a matrix"</span>);121 <a name="l00063"></a>00063 it_error(<span class="stringliteral">"requested vector is a matrix"</span>); 122 122 <a name="l00064"></a>00064 } 123 123 <a name="l00065"></a>00065 } <span class="keywordflow">else</span> { 124 <a name="l00066"></a>00066 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>(<span class="stringliteral">"requested vector has invalid type"</span>);124 <a name="l00066"></a>00066 it_error(<span class="stringliteral">"requested vector has invalid type"</span>); 125 125 <a name="l00067"></a>00067 } 126 126 <a name="l00068"></a>00068 <span class="keywordflow">return</span> vector; … … 142 142 <a name="l00085"></a>00085 <span class="keywordflow">case</span> Setting::TypeBoolean : 143 143 <a name="l00086"></a>00086 tmp ( r,c ) =bool ( S[i] );<span class="keywordflow">break</span>; 144 <a name="l00087"></a>00087 <span class="keywordflow">default</span>: <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"libconfig error?"</span> );144 <a name="l00087"></a>00087 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); 145 145 <a name="l00088"></a>00088 } 146 146 <a name="l00089"></a>00089 c++; <span class="keywordflow">if</span> ( c==ncols ) {c=0;r++;} … … 167 167 <a name="l00113"></a>00113 <span class="keywordflow">case</span> Setting::TypeBoolean : 168 168 <a name="l00114"></a>00114 tmp[i]=bool ( S[i] );<span class="keywordflow">break</span>; 169 <a name="l00115"></a>00115 <span class="keywordflow">default</span>: <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"libconfig error?"</span> );169 <a name="l00115"></a>00115 <span class="keywordflow">default</span>: it_error ( <span class="stringliteral">"libconfig error?"</span> ); 170 170 <a name="l00116"></a>00116 } 171 171 <a name="l00117"></a>00117 } … … 174 174 <a name="l00120"></a>00120 175 175 <a name="l00122"></a>00122 176 <a name="l00123"></a>00123 <span class="keyword">inline</span> <a class="code" href="classitpp_1_1Array.html">Array<string></a>get_as ( Setting& S ) {176 <a name="l00123"></a>00123 <span class="keyword">inline</span> Array<string> get_as ( Setting& S ) { 177 177 <a name="l00124"></a>00124 <span class="comment">//CHECK_UITYPE ( S,TypeArray );</span> 178 <a name="l00125"></a>00125 <a class="code" href="classitpp_1_1Array.html">Array<string></a>tmp;179 <a name="l00126"></a>00126 tmp. <a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&lt;T&gt;.">set_size</a>( S.getLength() );178 <a name="l00125"></a>00125 Array<string> tmp; 179 <a name="l00126"></a>00126 tmp.set_size ( S.getLength() ); 180 180 <a name="l00127"></a>00127 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<S.getLength();i++ ) {tmp ( i ) = ( <span class="keyword">const</span> <span class="keywordtype">char</span>* ) S[i];} 181 181 <a name="l00128"></a>00128 <span class="keywordflow">return</span> tmp; … … 209 209 <a name="l00183"></a>00183 CHECK_UITYPE ( S,TypeGroup ); 210 210 <a name="l00184"></a>00184 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> 211 <a name="l00185"></a>00185 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> );211 <a name="l00185"></a>00185 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); 212 212 <a name="l00186"></a>00186 213 213 <a name="l00187"></a>00187 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; … … 215 215 <a name="l00189"></a>00189 UImap::const_iterator iter = __uimap__.find ( typ ); 216 216 <a name="l00190"></a>00190 <span class="keywordflow">if</span> ( iter == __uimap__.end() ) { 217 <a name="l00191"></a>00191 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"UI of type \""</span> + typ + <span class="stringliteral">"\" is not registered!"</span> );217 <a name="l00191"></a>00191 it_error ( <span class="stringliteral">"UI of type \""</span> + typ + <span class="stringliteral">"\" is not registered!"</span> ); 218 218 <a name="l00192"></a>00192 } 219 219 <a name="l00193"></a>00193 … … 229 229 <a name="l00204"></a>00204 CHECK_UITYPE ( S,TypeGroup ); 230 230 <a name="l00205"></a>00205 <span class="comment">// Check if field "type" is present, if not it is not a valid UI</span> 231 <a name="l00206"></a>00206 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> );231 <a name="l00206"></a>00206 it_assert_debug ( S.exists ( <span class="stringliteral">"type"</span> ), string ( S.getPath() ) +<span class="stringliteral">" is not a valid UI!"</span> ); 232 232 <a name="l00207"></a>00207 233 233 <a name="l00208"></a>00208 <span class="keyword">const</span> <span class="keywordtype">string</span> typ=S[<span class="stringliteral">"type"</span>]; … … 242 242 <a name="l00217"></a>00217 } 243 243 <a name="l00218"></a>00218 <span class="keywordflow">catch</span> ( ... ) { 244 <a name="l00219"></a>00219 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"Internal field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> );244 <a name="l00219"></a>00219 it_error ( <span class="stringliteral">"Internal field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); 245 245 <a name="l00220"></a>00220 } 246 246 <a name="l00221"></a>00221 } … … 251 251 <a name="l00226"></a>00226 } 252 252 <a name="l00227"></a>00227 <span class="keywordflow">catch</span> ( ... ) { 253 <a name="l00228"></a>00228 <a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a>( <span class="stringliteral">"External field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> );253 <a name="l00228"></a>00228 it_error ( <span class="stringliteral">"External field "</span> + <span class="keywordtype">string</span> ( S.getPath() ) + <span class="stringliteral">" not valid"</span> ); 254 254 <a name="l00229"></a>00229 } 255 255 <a name="l00230"></a>00230 <span class="keywordflow">return</span>; … … 263 263 <a name="l00238"></a>00238 <span class="preprocessor">#endif //UIBUILD</span> 264 264 </pre></div></div> 265 <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10: 02:132009 for mixpp by 265 <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:11:00 2009 for mixpp by 266 266 <a href="http://www.doxygen.org/index.html"> 267 267 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>