68 | | <a name="l00004"></a>00004 |
69 | | <a name="l00005"></a>00005 <span class="preprocessor">#include <sstream></span> |
70 | | <a name="l00006"></a>00006 <span class="preprocessor">#include <iostream></span> |
71 | | <a name="l00007"></a>00007 <span class="preprocessor">#include <stdio.h></span> |
72 | | <a name="l00008"></a>00008 <span class="preprocessor">#include <string></span> |
73 | | <a name="l00009"></a>00009 <span class="preprocessor">#include <typeinfo></span> |
74 | | <a name="l00010"></a>00010 <span class="preprocessor">#include <map></span> |
75 | | <a name="l00011"></a>00011 <span class="preprocessor">#include <utility></span> |
76 | | <a name="l00012"></a>00012 <span class="preprocessor">#include <vector></span> |
77 | | <a name="l00013"></a>00013 <span class="preprocessor">#include <iostream></span> |
78 | | <a name="l00014"></a>00014 |
79 | | <a name="l00015"></a>00015 <span class="preprocessor">#include "libconfig/libconfig.h++"</span> |
80 | | <a name="l00016"></a>00016 |
81 | | <a name="l00017"></a>00017 <span class="preprocessor">#include <itpp/itbase.h></span> |
82 | | <a name="l00018"></a>00018 |
83 | | <a name="l00019"></a>00019 <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> |
84 | | <a name="l00020"></a>00020 |
85 | | <a name="l00021"></a>00021 <span class="keyword">using</span> std::string; |
86 | | <a name="l00022"></a>00022 <span class="keyword">using namespace </span>std; |
87 | | <a name="l00023"></a>00023 <span class="keyword">using namespace </span>libconfig; |
88 | | <a name="l00024"></a>00024 |
89 | | <a name="l00025"></a>00025 <span class="preprocessor">#define UIREGISTER(class_name) template<> Particular_UI<class_name>& Particular_UI<class_name>::ui = Particular_UI<class_name>(#class_name)</span> |
90 | | <a name="l00026"></a>00026 <span class="preprocessor"></span> |
91 | | <a name="l00027"></a>00027 <span class="preprocessor">#define ASSERT_UITYPE(S,Type) it_assert_debug(S.getType()==Setting::Type, string("Wrong setting type, see input path \"")+string(S.getPath())+string("\""))</span> |
92 | | <a name="l00028"></a>00028 <span class="preprocessor"></span> |
93 | | <a name="l00029"></a>00029 <span class="keyword">namespace </span>bdm |
94 | | <a name="l00030"></a>00030 { |
95 | | <a name="l00031"></a>00031 <span class="keyword">class </span>UI_File : <span class="keyword">public</span> Config |
96 | | <a name="l00032"></a>00032 { |
97 | | <a name="l00033"></a>00033 <span class="keyword">private</span>: |
98 | | <a name="l00034"></a>00034 <span class="keyword">const</span> <span class="keywordtype">string</span> file_name; |
99 | | <a name="l00035"></a>00035 |
100 | | <a name="l00036"></a>00036 <span class="keyword">public</span>: |
101 | | <a name="l00038"></a>00038 UI_File( <span class="keyword">const</span> <span class="keywordtype">string</span> &file_name ); |
102 | | <a name="l00039"></a>00039 |
103 | | <a name="l00041"></a>00041 <span class="keywordtype">void</span> load(); |
104 | | <a name="l00042"></a>00042 |
105 | | <a name="l00044"></a>00044 <span class="keywordtype">void</span> save(); |
106 | | <a name="l00045"></a>00045 |
107 | | <a name="l00046"></a>00046 operator Setting&(); |
108 | | <a name="l00047"></a>00047 }; |
109 | | <a name="l00048"></a>00048 |
110 | | <a name="l00086"></a><a class="code" href="classbdm_1_1UI.html">00086</a> |
111 | | <a name="l00093"></a>00093 |
| 68 | <a name="l00004"></a>00004 <span class="preprocessor">#include <stdio.h></span> |
| 69 | <a name="l00005"></a>00005 <span class="preprocessor">#include <string></span> |
| 70 | <a name="l00006"></a>00006 <span class="preprocessor">#include <typeinfo></span> |
| 71 | <a name="l00007"></a>00007 <span class="preprocessor">#include <map></span> |
| 72 | <a name="l00008"></a>00008 |
| 73 | <a name="l00009"></a>00009 <span class="preprocessor">#include "libconfig/libconfig.h++"</span> |
| 74 | <a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="bdmroot_8h.html" title="Bayesian Models (bm) that use Bayes rule to learn from observations.">bdmroot.h</a>"</span> |
| 75 | <a name="l00011"></a>00011 <span class="preprocessor">#include "itpp/itbase.h"</span> |
| 76 | <a name="l00012"></a>00012 |
| 77 | <a name="l00013"></a>00013 |
| 78 | <a name="l00014"></a>00014 <span class="keyword">using</span> std::string; |
| 79 | <a name="l00015"></a>00015 <span class="keyword">using namespace </span>std; |
| 80 | <a name="l00016"></a>00016 <span class="keyword">using namespace </span>libconfig; |
| 81 | <a name="l00017"></a>00017 |
| 82 | <a name="l00018"></a>00018 <span class="preprocessor">#ifndef BDMLIB </span> |
| 83 | <a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define UIREGISTER(class_name) template<> const Particular_UI<class_name>& Particular_UI<class_name>::ui = Particular_UI<class_name>(#class_name) </span> |
| 84 | <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#warning BDMLIB-defined</span> |
| 85 | <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#else</span> |
| 86 | <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define UIREGISTER(class_name)</span> |
| 87 | <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#warning BDMLIB-empty</span> |
| 88 | <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
| 89 | <a name="l00025"></a>00025 <span class="preprocessor"></span> |
| 90 | <a name="l00026"></a>00026 <span class="preprocessor">#define ASSERT_UITYPE(S,Type) it_assert_debug(S.getType()==Setting::Type, string("Wrong setting type, see input path \"")+string(S.getPath())+string("\""))</span> |
| 91 | <a name="l00027"></a>00027 <span class="preprocessor"></span> |
| 92 | <a name="l00028"></a>00028 <span class="keyword">namespace </span>bdm |
| 93 | <a name="l00029"></a>00029 { |
| 94 | <a name="l00030"></a>00030 <span class="keyword">class </span>UI_File : <span class="keyword">public</span> Config |
| 95 | <a name="l00031"></a>00031 { |
| 96 | <a name="l00032"></a>00032 <span class="keyword">private</span>: |
| 97 | <a name="l00033"></a>00033 <span class="keyword">const</span> <span class="keywordtype">string</span> file_name; |
| 98 | <a name="l00034"></a>00034 |
| 99 | <a name="l00035"></a>00035 <span class="keyword">public</span>: |
| 100 | <a name="l00037"></a>00037 UI_File(); |
| 101 | <a name="l00038"></a>00038 |
| 102 | <a name="l00040"></a>00040 UI_File( <span class="keyword">const</span> <span class="keywordtype">string</span> &file_name ); |
| 103 | <a name="l00041"></a>00041 |
| 104 | <a name="l00043"></a>00043 <span class="keywordtype">void</span> save(<span class="keyword">const</span> <span class="keywordtype">string</span> &file_name); |
| 105 | <a name="l00044"></a>00044 |
| 106 | <a name="l00045"></a>00045 operator Setting&(); |
| 107 | <a name="l00046"></a>00046 }; |
| 108 | <a name="l00047"></a>00047 |
| 109 | <a name="l00079"></a><a class="code" href="classbdm_1_1UI.html">00079</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UI.html" title="This class serves to load and/or save DOMElements into/from files stored on a hard-disk...">UI</a> |
| 110 | <a name="l00080"></a>00080 { |
| 111 | <a name="l00081"></a>00081 <span class="keyword">private</span>: |
| 112 | <a name="l00086"></a>00086 <span class="keyword">class </span>Mapped_UI |
| 113 | <a name="l00087"></a>00087 { |
| 114 | <a name="l00088"></a>00088 <span class="keyword">private</span>: |
| 115 | <a name="l00090"></a>00090 <span class="keyword">typedef</span> map< const string, const UI* const > String_To_UI_Map; |
| 116 | <a name="l00091"></a>00091 |
| 117 | <a name="l00093"></a>00093 <span class="keyword">typedef</span> map< const type_info * const, const string > Type_Info_To_String_Map; |
| 118 | <a name="l00094"></a>00094 |
| 119 | <a name="l00096"></a>00096 <span class="keyword">static</span> String_To_UI_Map& mapped_strings(); |
123 | | <a name="l00159"></a>00159 |
124 | | <a name="l00199"></a>00199 |
125 | | <a name="l00217"></a><a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8">00217</a> |
126 | | <a name="l00223"></a><a class="code" href="classbdm_1_1UI.html#95a5a0e160bf21357f99a9291b0b5e88">00223</a> |
127 | | <a name="l00237"></a>00237 |
128 | | <a name="l00239"></a><a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125">00239</a> |
129 | | <a name="l00254"></a><a class="code" href="classbdm_1_1UI.html#32e63fc6ca11603442d46350bb66a76f">00254</a> |
130 | | <a name="l00263"></a><a class="code" href="classbdm_1_1UI.html#0d197e27bb914fe6cc1ca41b90899742">00263</a> |
131 | | <a name="l00272"></a><a class="code" href="classbdm_1_1UI.html#7b83f1e2352f9ed7fb65437dd33e2005">00272</a> |
132 | | <a name="l00281"></a><a class="code" href="classbdm_1_1UI.html#472abdce7adb048a40ef3d84ed0f592d">00281</a> |
133 | | <a name="l00311"></a><a class="code" href="classbdm_1_1UI.html#4514f93573a9d9126c506d176fbd3163">00311</a> |
134 | | <a name="l00322"></a>00322 |
135 | | <a name="l00325"></a>00325 |
136 | | <a name="l00329"></a>00329 |
137 | | <a name="l00339"></a><a class="code" href="classbdm_1_1Particular__UI.html">00339</a> |
| 166 | <a name="l00156"></a>00156 instance = NULL; |
| 167 | <a name="l00157"></a>00157 <span class="keywordflow">try</span> |
| 168 | <a name="l00158"></a>00158 { |
| 169 | <a name="l00159"></a>00159 instance = (T*) typeless_instance ; |
| 170 | <a name="l00160"></a>00160 } |
| 171 | <a name="l00161"></a>00161 <span class="keywordflow">catch</span>(...) |
| 172 | <a name="l00162"></a>00162 { |
| 173 | <a name="l00163"></a>00163 it_error ( <span class="stringliteral">"UI error: class "</span> + class_name + <span class="stringliteral">" is not a descendant of the desired output class. Try to call the UI::build function with a different type parameter."</span> ); |
| 174 | <a name="l00164"></a>00164 } |
| 175 | <a name="l00165"></a>00165 |
| 176 | <a name="l00166"></a>00166 <span class="keywordflow">try</span> |
| 177 | <a name="l00167"></a>00167 { |
| 178 | <a name="l00168"></a>00168 instance->from_setting( root ); |
| 179 | <a name="l00169"></a>00169 } |
| 180 | <a name="l00170"></a>00170 <span class="keywordflow">catch</span>(SettingException xcptn) |
| 181 | <a name="l00171"></a>00171 { |
| 182 | <a name="l00172"></a>00172 it_error ( <span class="stringliteral">"UI error: the method "</span> + class_name + <span class="stringliteral">".from_setting(Setting&) has thrown an exception when parsing the setting "</span> + xcptn.getPath() + <span class="stringliteral">". Try to correct this method."</span> ); |
| 183 | <a name="l00173"></a>00173 } |
| 184 | <a name="l00174"></a>00174 } |
| 185 | <a name="l00175"></a>00175 |
| 186 | <a name="l00176"></a>00176 |
| 187 | <a name="l00178"></a>00178 <span class="comment">// efektivne jen pro vect, mat a string, pro dalsi je nutne pridat from_setting metodu.. ale to asi necceme</span> |
| 188 | <a name="l00179"></a>00179 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( Array<T> &array_to_load, <span class="keyword">const</span> Setting &element ) |
| 189 | <a name="l00180"></a>00180 { |
| 190 | <a name="l00181"></a>00181 <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html">SettingsResolver</a> link_expander( element ); |
| 191 | <a name="l00182"></a>00182 <span class="keyword">const</span> Setting &root = link_expander.<a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html#5b09858b705318e7f23c3077fc62c199">root</a>(); |
| 192 | <a name="l00183"></a>00183 |
| 193 | <a name="l00184"></a>00184 ASSERT_UITYPE(root,TypeList); |
| 194 | <a name="l00185"></a>00185 |
| 195 | <a name="l00186"></a>00186 <span class="keywordtype">int</span> len = root.getLength(); |
| 196 | <a name="l00187"></a>00187 array_to_load.set_length( len ); |
| 197 | <a name="l00188"></a>00188 <span class="keywordflow">if</span>( len == 0 ) <span class="keywordflow">return</span>; |
| 198 | <a name="l00189"></a>00189 |
| 199 | <a name="l00190"></a>00190 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i < len; i++ ) |
| 200 | <a name="l00191"></a>00191 from_setting( array_to_load(i), root[i] ); |
| 201 | <a name="l00192"></a>00192 } |
| 202 | <a name="l00193"></a>00193 |
| 203 | <a name="l00195"></a>00195 |
| 204 | <a name="l00196"></a>00196 |
| 205 | <a name="l00197"></a>00197 <span class="keyword">static</span> <span class="keywordtype">void</span> ui_error( <span class="keywordtype">string</span> message, <span class="keyword">const</span> Setting &element ); |
| 206 | <a name="l00198"></a>00198 |
| 207 | <a name="l00199"></a>00199 <span class="keyword">protected</span>: |
| 208 | <a name="l00201"></a><a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8">00201</a> <a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8" title="default constructor">UI</a>( <span class="keyword">const</span> <span class="keywordtype">string</span>& class_name, <span class="keyword">const</span> type_info * <span class="keyword">const</span> class_type_info ) |
| 209 | <a name="l00202"></a>00202 { |
| 210 | <a name="l00203"></a>00203 Mapped_UI::add_class( class_name, class_type_info, <span class="keyword">this</span> ); |
| 211 | <a name="l00204"></a>00204 } |
| 212 | <a name="l00205"></a>00205 |
| 213 | <a name="l00207"></a><a class="code" href="classbdm_1_1UI.html#95a5a0e160bf21357f99a9291b0b5e88">00207</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1UI.html#95a5a0e160bf21357f99a9291b0b5e88" title="Virtual destructor for future use;.">~UI</a>(){}; |
| 214 | <a name="l00208"></a>00208 |
| 215 | <a name="l00209"></a>00209 <span class="keyword">public</span>: |
| 216 | <a name="l00213"></a>00213 |
| 217 | <a name="l00214"></a>00214 <span class="comment">// vraci true, kdyz to byl platny link, jinak false.. v pripade chyby konci it_errorem..</span> |
| 218 | <a name="l00215"></a>00215 <span class="comment">// do elementu vrati setting prislusny po rozbaleni linku, jinak ponecha beze zmeny</span> |
| 219 | <a name="l00216"></a><a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html">00216</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html">SettingsResolver</a> |
| 220 | <a name="l00217"></a>00217 { |
| 221 | <a name="l00218"></a>00218 <span class="keyword">private</span>: |
| 222 | <a name="l00219"></a>00219 UI_File *file; |
| 223 | <a name="l00220"></a>00220 <span class="keyword">const</span> Setting *result; |
| 224 | <a name="l00221"></a>00221 |
| 225 | <a name="l00222"></a>00222 <span class="keyword">public</span>: |
| 226 | <a name="l00223"></a>00223 |
| 227 | <a name="l00224"></a>00224 <a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html">SettingsResolver</a>( <span class="keyword">const</span> Setting &potential_link ); |
| 228 | <a name="l00225"></a>00225 |
| 229 | <a name="l00226"></a>00226 ~<a class="code" href="classbdm_1_1UI_1_1SettingsResolver.html">SettingsResolver</a>(); |
| 230 | <a name="l00227"></a>00227 |
| 231 | <a name="l00228"></a>00228 <span class="keyword">const</span> Setting& root() <span class="keyword">const</span>; |
| 232 | <a name="l00229"></a>00229 }; |
| 233 | <a name="l00230"></a>00230 |
| 234 | <a name="l00231"></a>00231 |
| 235 | <a name="l00232"></a>00232 |
| 236 | <a name="l00234"></a><a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125">00234</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> T* <a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ) |
| 237 | <a name="l00235"></a>00235 { |
| 238 | <a name="l00236"></a>00236 T* instance; |
| 239 | <a name="l00237"></a>00237 from_setting<T>( to_child_setting( element, index ) ); |
| 240 | <a name="l00238"></a>00238 <span class="keywordflow">return</span> instance; |
| 241 | <a name="l00239"></a>00239 } |
| 242 | <a name="l00240"></a>00240 |
| 243 | <a name="l00241"></a>00241 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> T* <a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ) |
| 244 | <a name="l00242"></a>00242 { |
| 245 | <a name="l00243"></a>00243 T* instance; |
| 246 | <a name="l00244"></a>00244 from_setting<T>( instance, to_child_setting( element, name ) ); |
| 247 | <a name="l00245"></a>00245 <span class="keywordflow">return</span> instance; |
| 248 | <a name="l00246"></a>00246 } |
| 249 | <a name="l00247"></a>00247 |
| 250 | <a name="l00249"></a><a class="code" href="classbdm_1_1UI.html#652bfd23f5052e4f1cb317057d74a3e2">00249</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">get</span>( T &instance, <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ) |
| 251 | <a name="l00250"></a>00250 { |
| 252 | <a name="l00251"></a>00251 from_setting( instance, to_child_setting( element, name ) ); |
| 253 | <a name="l00252"></a>00252 } |
| 254 | <a name="l00253"></a>00253 |
| 255 | <a name="l00255"></a><a class="code" href="classbdm_1_1UI.html#3d04bb3d7dbcf0da0b4d5d3d5b7df51a">00255</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">get</span>( T &instance, <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ) |
| 256 | <a name="l00256"></a>00256 { |
| 257 | <a name="l00257"></a>00257 from_setting( instance, to_child_setting( element, index ) ); |
| 258 | <a name="l00258"></a>00258 } |
| 259 | <a name="l00259"></a>00259 |
| 260 | <a name="l00261"></a><a class="code" href="classbdm_1_1UI.html#00bb5f2a328d272b0a3ffbda1a902d54">00261</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">get</span>( Array<T> &array_to_load, <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ) |
| 261 | <a name="l00262"></a>00262 { |
| 262 | <a name="l00263"></a>00263 from_setting( array_to_load, to_child_setting( element, name ) ); |
| 263 | <a name="l00264"></a>00264 } |
| 264 | <a name="l00265"></a>00265 |
| 265 | <a name="l00267"></a><a class="code" href="classbdm_1_1UI.html#b6a224b6aea027e167d3d565b39144e0">00267</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <span class="keyword">get</span>( Array<T> &array_to_load, <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ) |
| 266 | <a name="l00268"></a>00268 { |
| 267 | <a name="l00269"></a>00269 from_setting( array_to_load, to_child_setting( element, index ) ); |
| 268 | <a name="l00270"></a>00270 } |
| 269 | <a name="l00271"></a>00271 |
| 270 | <a name="l00272"></a>00272 <span class="keyword">template</span>< <span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> T * <span class="keyword">const</span> instance, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span>) |
| 271 | <a name="l00273"></a>00273 { |
| 272 | <a name="l00274"></a>00274 Setting &root = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeGroup ) |
| 273 | <a name="l00275"></a>00275 : element.add( name, Setting::TypeGroup ); |
| 274 | <a name="l00276"></a>00276 |
| 275 | <a name="l00277"></a>00277 <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name = Mapped_UI::retrieve_class_name( &<span class="keyword">typeid</span>(*instance) ); |
| 276 | <a name="l00278"></a>00278 |
| 277 | <a name="l00279"></a>00279 <span class="comment">// add attribute "class" </span> |
| 278 | <a name="l00280"></a>00280 Setting &type = root.add( <span class="stringliteral">"class"</span>, Setting::TypeString ); |
| 279 | <a name="l00281"></a>00281 type = class_name; |
| 280 | <a name="l00282"></a>00282 |
| 281 | <a name="l00283"></a>00283 <span class="keywordflow">try</span> |
| 282 | <a name="l00284"></a>00284 { |
| 283 | <a name="l00285"></a>00285 instance->to_setting( root ); |
| 284 | <a name="l00286"></a>00286 } |
| 285 | <a name="l00287"></a>00287 <span class="keywordflow">catch</span>(SettingException xcptn) |
| 286 | <a name="l00288"></a>00288 { |
| 287 | <a name="l00289"></a>00289 it_error ( <span class="stringliteral">"UI error: the method "</span> + class_name + <span class="stringliteral">".to_setting(Setting&) has thrown an exception when filling the setting "</span> + xcptn.getPath() + <span class="stringliteral">". Try to correct this method."</span> ); |
| 288 | <a name="l00290"></a>00290 } |
| 289 | <a name="l00291"></a>00291 } |
| 290 | <a name="l00292"></a>00292 |
| 291 | <a name="l00294"></a><a class="code" href="classbdm_1_1UI.html#4514f93573a9d9126c506d176fbd3163">00294</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> Array<T> &array_to_save, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ) |
| 292 | <a name="l00295"></a>00295 { |
| 293 | <a name="l00296"></a>00296 ASSERT_UITYPE(element,TypeGroup); |
| 294 | <a name="l00297"></a>00297 Setting &list = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeList ) |
| 295 | <a name="l00298"></a>00298 : element.add( name, Setting::TypeList ); |
| 296 | <a name="l00299"></a>00299 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<array_to_save.length(); i++ ) |
| 297 | <a name="l00300"></a>00300 save( array_to_save(i), list ); |
| 298 | <a name="l00301"></a>00301 } |
| 299 | <a name="l00302"></a>00302 |
| 300 | <a name="l00303"></a>00303 |
| 301 | <a name="l00305"></a>00305 <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> mat &matrix, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 302 | <a name="l00306"></a>00306 |
| 303 | <a name="l00308"></a>00308 <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> ivec &vec, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 304 | <a name="l00309"></a>00309 |
| 305 | <a name="l00310"></a>00310 <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> vec &vector, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name); |
| 306 | <a name="l00311"></a>00311 |
| 307 | <a name="l00312"></a>00312 <span class="keyword">private</span>: |
| 308 | <a name="l00314"></a>00314 <span class="keyword">static</span> <span class="keywordtype">void</span> save( <span class="keyword">const</span> <span class="keywordtype">string</span> &str, Setting &element); |
| 309 | <a name="l00315"></a>00315 |
| 310 | <a name="l00316"></a>00316 }; |
| 311 | <a name="l00317"></a>00317 |
| 312 | <a name="l00318"></a>00318 |
| 313 | <a name="l00324"></a><a class="code" href="classbdm_1_1Particular__UI.html">00324</a> <span class="keyword">template</span><<span class="keyword">typename</span> T> <span class="keyword">class </span><a class="code" href="classbdm_1_1Particular__UI.html" title="The main userinfo template class. You should derive this class whenever you need...">Particular_UI</a> : <span class="keyword">private</span> <a class="code" href="classbdm_1_1UI.html" title="This class serves to load and/or save DOMElements into/from files stored on a hard-disk...">UI</a> |
| 314 | <a name="l00325"></a>00325 { |
| 315 | <a name="l00326"></a>00326 <span class="keyword">public</span>: |
| 316 | <a name="l00327"></a>00327 |
| 317 | <a name="l00329"></a>00329 <a class="code" href="classbdm_1_1Particular__UI.html" title="The main userinfo template class. You should derive this class whenever you need...">Particular_UI<T></a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name) : <a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8" title="default constructor">UI</a>( class_name, &<span class="keyword">typeid</span>(T) ) |
| 318 | <a name="l00330"></a>00330 { cout << class_name << endl; |
| 319 | <a name="l00331"></a><a class="code" href="classbdm_1_1Particular__UI.html#ca33b00e0c341706003930c4b20a1e36">00331</a> }; |
| 320 | <a name="l00332"></a>00332 |
| 321 | <a name="l00335"></a>00335 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1Particular__UI.html" title="The main userinfo template class. You should derive this class whenever you need...">Particular_UI<T></a>& <a class="code" href="classbdm_1_1Particular__UI.html#ca33b00e0c341706003930c4b20a1e36">ui</a>; |
| 322 | <a name="l00336"></a>00336 |
| 323 | <a name="l00337"></a><a class="code" href="classbdm_1_1Particular__UI.html#6ae004150ae2de7645c62219c74340ff">00337</a> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classbdm_1_1Particular__UI.html#6ae004150ae2de7645c62219c74340ff" title="internal method assembling a typeless instance from components obtained by the &#39;AssemblyComponen...">new_instance</a>()<span class="keyword"> const</span> |
| 324 | <a name="l00338"></a>00338 <span class="keyword"> </span>{ |
| 325 | <a name="l00339"></a>00339 <span class="keywordflow">return</span> <span class="keyword">new</span> T(); |
| 326 | <a name="l00340"></a>00340 } |
| 327 | <a name="l00341"></a>00341 }; |
| 328 | <a name="l00342"></a>00342 |
| 329 | <a name="l00343"></a>00343 |
| 330 | <a name="l00344"></a>00344 |