116 | | <a name="l00100"></a><a class="code" href="classbdm_1_1UIFile.html">00100</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> : <span class="keyword">public</span> Config |
117 | | <a name="l00101"></a>00101 { |
118 | | <a name="l00102"></a>00102 <span class="keyword">public</span>: |
119 | | <a name="l00104"></a>00104 <a class="code" href="classbdm_1_1UIFile.html#77274c827f87f16bd6671df8a0cc1e33" title="Create empty file instance prepared to store Settings.">UIFile</a>(); |
120 | | <a name="l00105"></a>00105 |
121 | | <a name="l00107"></a>00107 <a class="code" href="classbdm_1_1UIFile.html#77274c827f87f16bd6671df8a0cc1e33" title="Create empty file instance prepared to store Settings.">UIFile</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &file_name ); |
122 | | <a name="l00108"></a>00108 |
123 | | <a name="l00110"></a>00110 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UIFile.html#1f8af28a0d8ef1a4956e198df0beb5ba" title="Save all the stored Settings into the configuration file file_name.">save</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &file_name); |
124 | | <a name="l00111"></a>00111 |
125 | | <a name="l00113"></a>00113 <a class="code" href="classbdm_1_1UIFile.html#5bce10d88c71f6147d58baa8400ff61f" title="This operator allows the ability of substituting Setting parameter by UIFile instance...">operator Setting&</a>(); |
126 | | <a name="l00114"></a>00114 }; |
127 | | <a name="l00115"></a>00115 |
128 | | <a name="l00180"></a><a class="code" href="classbdm_1_1SettingResolver.html">00180</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> : <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> |
129 | | <a name="l00181"></a>00181 { |
130 | | <a name="l00182"></a>00182 <span class="keyword">private</span>: |
131 | | <a name="l00184"></a>00184 <a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> *file; |
132 | | <a name="l00185"></a>00185 |
133 | | <a name="l00191"></a>00191 <span class="keyword">const</span> Setting &initialize_reference( <a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a>* &file, <span class="keyword">const</span> Setting &potential_link); |
134 | | <a name="l00192"></a>00192 |
135 | | <a name="l00193"></a>00193 <span class="keyword">public</span>: |
136 | | <a name="l00195"></a><a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498">00195</a> <span class="keyword">const</span> Setting &<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>; |
137 | | <a name="l00196"></a>00196 |
138 | | <a name="l00198"></a>00198 <a class="code" href="classbdm_1_1SettingResolver.html#e2299746b95bf8af54a867aaf52fc8da" title="If potential_link contains a link to some other setting, it is resolved here. Anyway...">SettingResolver</a>( <span class="keyword">const</span> Setting &potential_link ); |
139 | | <a name="l00199"></a>00199 |
140 | | <a name="l00201"></a>00201 <a class="code" href="classbdm_1_1SettingResolver.html#c8b29999710e2db98c1a3979e25e6bbc" title="An opened UIFile file is closed here if necessary.">~SettingResolver</a>(); |
141 | | <a name="l00202"></a>00202 }; |
142 | | <a name="l00203"></a>00203 |
143 | | <a name="l00211"></a><a class="code" href="classbdm_1_1UI.html">00211</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a> |
144 | | <a name="l00212"></a>00212 { |
145 | | <a name="l00213"></a>00213 <span class="keyword">private</span>: |
146 | | <a name="l00219"></a>00219 <span class="keyword">class </span>MappedUI |
147 | | <a name="l00220"></a>00220 { |
148 | | <a name="l00221"></a>00221 <span class="keyword">private</span>: |
149 | | <a name="l00223"></a>00223 <span class="keyword">typedef</span> map< const string, const UI* const > StringToUIMap; |
150 | | <a name="l00224"></a>00224 |
151 | | <a name="l00226"></a>00226 <span class="keyword">typedef</span> map< const type_info * const, const string > TypeInfoToStringMap; |
152 | | <a name="l00227"></a>00227 |
153 | | <a name="l00229"></a>00229 <span class="keyword">static</span> StringToUIMap& mapped_strings(); |
154 | | <a name="l00230"></a>00230 |
155 | | <a name="l00232"></a>00232 <span class="keyword">static</span> TypeInfoToStringMap& mapped_type_infos(); |
156 | | <a name="l00233"></a>00233 |
157 | | <a name="l00235"></a>00235 <span class="keyword">static</span> <span class="keywordtype">void</span> unregistered_class_error( <span class="keyword">const</span> <span class="keywordtype">string</span> &unregistered_class_name ); |
158 | | <a name="l00236"></a>00236 |
159 | | <a name="l00237"></a>00237 <span class="keyword">public</span>: |
160 | | <a name="l00239"></a>00239 <span class="keyword">static</span> <span class="keywordtype">void</span> add_class( <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, <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>* <span class="keyword">const</span> ui ); |
161 | | <a name="l00240"></a>00240 |
162 | | <a name="l00242"></a>00242 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>& retrieve_ui( <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name ); |
163 | | <a name="l00243"></a>00243 |
164 | | <a name="l00245"></a>00245 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">string</span>& retrieve_class_name( <span class="keyword">const</span> type_info* <span class="keyword">const</span> class_type_info ); |
165 | | <a name="l00246"></a>00246 }; |
166 | | <a name="l00247"></a>00247 |
167 | | <a name="l00249"></a>00249 <span class="keyword">static</span> <span class="keywordtype">void</span> assert_type( <span class="keyword">const</span> Setting &element, Setting::Type type); |
168 | | <a name="l00250"></a>00250 |
169 | | <a name="l00252"></a>00252 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a>* new_instance() <span class="keyword">const</span> = 0; |
170 | | <a name="l00253"></a>00253 |
171 | | <a name="l00255"></a>00255 <span class="keyword">static</span> <span class="keyword">const</span> Setting& to_child_setting( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ); |
172 | | <a name="l00256"></a>00256 |
173 | | <a name="l00258"></a>00258 <span class="keyword">static</span> <span class="keyword">const</span> Setting& to_child_setting( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ); |
174 | | <a name="l00259"></a>00259 |
175 | | <a name="l00261"></a>00261 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( mat& matrix, <span class="keyword">const</span> Setting &element ); |
176 | | <a name="l00263"></a>00263 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( ivec &vector, <span class="keyword">const</span> Setting &element ); |
177 | | <a name="l00265"></a>00265 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">string</span> &<a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs - TODO tak proc je ve verejnem...">str</a>, <span class="keyword">const</span> Setting &element ); |
178 | | <a name="l00267"></a>00267 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( vec &vector, <span class="keyword">const</span> Setting &element ); |
179 | | <a name="l00269"></a>00269 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">int</span> &integer, <span class="keyword">const</span> Setting &element ); |
180 | | <a name="l00271"></a>00271 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">double</span> &real, <span class="keyword">const</span> Setting &element ); |
181 | | <a name="l00273"></a>00273 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( T* &instance, <span class="keyword">const</span> Setting &element ) |
182 | | <a name="l00274"></a>00274 { |
183 | | <a name="l00275"></a>00275 <span class="keyword">const</span> <a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> link( element ); |
184 | | <a name="l00276"></a>00276 assert_type(link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>,Setting::TypeGroup); |
185 | | <a name="l00277"></a>00277 |
186 | | <a name="l00278"></a>00278 <span class="comment">// we get a value stored in the "class" attribute </span> |
187 | | <a name="l00279"></a>00279 <span class="keywordtype">string</span> class_name; |
188 | | <a name="l00280"></a>00280 <span class="keywordflow">if</span>( !link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>.lookupValue( <span class="stringliteral">"class"</span>, class_name ) ) |
189 | | <a name="l00281"></a>00281 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the obligatory \"class\" identifier is missing"</span>, link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
190 | | <a name="l00282"></a>00282 |
191 | | <a name="l00283"></a>00283 <span class="comment">// then we find a user-info related to this type</span> |
192 | | <a name="l00284"></a>00284 <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>& related_UI = MappedUI::retrieve_ui( class_name ); |
193 | | <a name="l00285"></a>00285 |
194 | | <a name="l00286"></a>00286 <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a>* typeless_instance = related_UI.<a class="code" href="classbdm_1_1UI.html#77291f28a4b951522ae5f6a03121b635" title="Method assembling a typeless instance, it is implemented in descendant class ParticularUI&lt;T&gt;...">new_instance</a>(); |
195 | | <a name="l00287"></a>00287 |
196 | | <a name="l00288"></a>00288 instance = <span class="keyword">dynamic_cast<</span>T*<span class="keyword">></span>(typeless_instance); |
197 | | <a name="l00289"></a>00289 <span class="keywordflow">if</span> (!instance) |
198 | | <a name="l00290"></a>00290 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"class "</span> + class_name + <span class="stringliteral">" is not a descendant of the desired output class. Try to call the UI::build<T> function with a different type parameter."</span>, link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
199 | | <a name="l00291"></a>00291 |
200 | | <a name="l00292"></a>00292 <span class="keywordflow">try</span> |
201 | | <a name="l00293"></a>00293 { |
202 | | <a name="l00294"></a>00294 instance->from_setting( link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
203 | | <a name="l00295"></a>00295 } |
204 | | <a name="l00296"></a>00296 <span class="keywordflow">catch</span>(SettingException xcptn) |
205 | | <a name="l00297"></a>00297 { |
206 | | <a name="l00298"></a>00298 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the method "</span> + class_name + <span class="stringliteral">".from_setting(Setting&) has thrown an SettingException. Try to correct this method"</span>, xcptn.getPath()); |
207 | | <a name="l00299"></a>00299 } |
208 | | <a name="l00300"></a>00300 } |
209 | | <a name="l00301"></a>00301 |
210 | | <a name="l00303"></a>00303 <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 ) |
211 | | <a name="l00304"></a>00304 { |
212 | | <a name="l00305"></a>00305 <span class="keyword">const</span> <a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> link( element ); |
213 | | <a name="l00306"></a>00306 |
214 | | <a name="l00307"></a>00307 assert_type(link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>,Setting::TypeList); |
215 | | <a name="l00308"></a>00308 |
216 | | <a name="l00309"></a>00309 <span class="keywordtype">int</span> len = link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>.getLength(); |
217 | | <a name="l00310"></a>00310 array_to_load.set_length( len ); |
218 | | <a name="l00311"></a>00311 <span class="keywordflow">if</span>( len == 0 ) <span class="keywordflow">return</span>; |
219 | | <a name="l00312"></a>00312 |
220 | | <a name="l00313"></a>00313 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i < len; i++ ) |
221 | | <a name="l00314"></a>00314 from_setting( array_to_load(i), link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>[i] ); |
222 | | <a name="l00315"></a>00315 } |
223 | | <a name="l00316"></a>00316 |
224 | | <a name="l00317"></a>00317 <span class="keyword">protected</span>: |
225 | | <a name="l00319"></a><a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8">00319</a> <a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8" title="Default constructor for internal use only, see.">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 ) |
226 | | <a name="l00320"></a>00320 { |
227 | | <a name="l00321"></a>00321 MappedUI::add_class( class_name, class_type_info, <span class="keyword">this</span> ); |
228 | | <a name="l00322"></a>00322 } |
229 | | <a name="l00323"></a>00323 |
230 | | <a name="l00324"></a>00324 <span class="keyword">public</span>: |
231 | | <a name="l00325"></a>00325 |
232 | | <a name="l00329"></a>00329 |
233 | | <a name="l00331"></a><a class="code" href="classbdm_1_1UI.html#dda27449f8bd19d54db9ccfb2644e908">00331</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ) |
234 | | <a name="l00332"></a>00332 { |
235 | | <a name="l00333"></a>00333 T* instance; |
236 | | <a name="l00334"></a>00334 from_setting<T>( instance, to_child_setting( element, name ) ); |
237 | | <a name="l00335"></a>00335 <span class="keywordflow">return</span> instance; |
238 | | <a name="l00336"></a>00336 } |
239 | | <a name="l00338"></a><a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125">00338</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ) |
240 | | <a name="l00339"></a>00339 { |
241 | | <a name="l00340"></a>00340 T* instance; |
242 | | <a name="l00341"></a>00341 from_setting<T>( instance, to_child_setting( element, index ) ); |
243 | | <a name="l00342"></a>00342 <span class="keywordflow">return</span> instance; |
244 | | <a name="l00343"></a>00343 } |
245 | | <a name="l00345"></a><a class="code" href="classbdm_1_1UI.html#6e2da6a142fecf5f21e0bb86a7211cb4">00345</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element ) |
246 | | <a name="l00346"></a>00346 { |
247 | | <a name="l00347"></a>00347 T* instance; |
248 | | <a name="l00348"></a>00348 from_setting<T>( instance, element ); |
249 | | <a name="l00349"></a>00349 <span class="keywordflow">return</span> instance; |
250 | | <a name="l00350"></a>00350 } |
251 | | <a name="l00352"></a>00352 |
252 | | <a name="l00356"></a>00356 |
253 | | <a name="l00358"></a><a class="code" href="classbdm_1_1UI.html#652bfd23f5052e4f1cb317057d74a3e2">00358</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 ) |
254 | | <a name="l00359"></a>00359 { |
255 | | <a name="l00360"></a>00360 from_setting( instance, to_child_setting( element, name ) ); |
256 | | <a name="l00361"></a>00361 } |
257 | | <a name="l00362"></a>00362 |
258 | | <a name="l00364"></a><a class="code" href="classbdm_1_1UI.html#3d04bb3d7dbcf0da0b4d5d3d5b7df51a">00364</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 ) |
259 | | <a name="l00365"></a>00365 { |
260 | | <a name="l00366"></a>00366 from_setting( instance, to_child_setting( element, index ) ); |
261 | | <a name="l00367"></a>00367 } |
262 | | <a name="l00368"></a>00368 |
263 | | <a name="l00370"></a><a class="code" href="classbdm_1_1UI.html#25747ac6d0232aa7102dbb316f65ddce">00370</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 ) |
264 | | <a name="l00371"></a>00371 { |
265 | | <a name="l00372"></a>00372 from_setting( instance, element ); |
266 | | <a name="l00373"></a>00373 } |
267 | | <a name="l00375"></a>00375 |
268 | | <a name="l00379"></a>00379 |
269 | | <a name="l00381"></a><a class="code" href="classbdm_1_1UI.html#00bb5f2a328d272b0a3ffbda1a902d54">00381</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 ) |
270 | | <a name="l00382"></a>00382 { |
271 | | <a name="l00383"></a>00383 from_setting( array_to_load, to_child_setting( element, name ) ); |
272 | | <a name="l00384"></a>00384 } |
273 | | <a name="l00385"></a>00385 |
274 | | <a name="l00387"></a><a class="code" href="classbdm_1_1UI.html#b6a224b6aea027e167d3d565b39144e0">00387</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 ) |
275 | | <a name="l00388"></a>00388 { |
276 | | <a name="l00389"></a>00389 from_setting( array_to_load, to_child_setting( element, index ) ); |
277 | | <a name="l00390"></a>00390 } |
278 | | <a name="l00391"></a>00391 |
279 | | <a name="l00393"></a><a class="code" href="classbdm_1_1UI.html#4fc5efdc58e4e184218b6d5beeb5ceab">00393</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 ) |
280 | | <a name="l00394"></a>00394 { |
281 | | <a name="l00395"></a>00395 from_setting( array_to_load, element ); |
282 | | <a name="l00396"></a>00396 } |
283 | | <a name="l00398"></a>00398 |
284 | | <a name="l00403"></a>00403 |
285 | | <a name="l00405"></a><a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917">00405</a> <span class="keyword">template</span>< <span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <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>) |
286 | | <a name="l00406"></a>00406 { |
287 | | <a name="l00407"></a>00407 Setting &<span class="keyword">set</span> = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeGroup ) |
288 | | <a name="l00408"></a>00408 : element.add( name, Setting::TypeGroup ); |
289 | | <a name="l00409"></a>00409 |
290 | | <a name="l00410"></a>00410 <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name = MappedUI::retrieve_class_name( &<span class="keyword">typeid</span>(*instance) ); |
291 | | <a name="l00411"></a>00411 |
292 | | <a name="l00412"></a>00412 <span class="comment">// add attribute "class" </span> |
293 | | <a name="l00413"></a>00413 Setting &type = <span class="keyword">set</span>.add( <span class="stringliteral">"class"</span>, Setting::TypeString ); |
294 | | <a name="l00414"></a>00414 type = class_name; |
295 | | <a name="l00415"></a>00415 |
296 | | <a name="l00416"></a>00416 <span class="keywordflow">try</span> |
297 | | <a name="l00417"></a>00417 { |
298 | | <a name="l00418"></a>00418 instance->to_setting( <span class="keyword">set</span> ); |
299 | | <a name="l00419"></a>00419 } |
300 | | <a name="l00420"></a>00420 <span class="keywordflow">catch</span>(SettingException xcptn) |
301 | | <a name="l00421"></a>00421 { |
302 | | <a name="l00422"></a>00422 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the method "</span> + class_name + <span class="stringliteral">".to_setting(Setting&) has thrown an SettingException. Try to correct this method"</span>, xcptn.getPath()); |
303 | | <a name="l00423"></a>00423 } |
304 | | <a name="l00424"></a>00424 } |
305 | | <a name="l00425"></a>00425 |
306 | | <a name="l00427"></a><a class="code" href="classbdm_1_1UI.html#4514f93573a9d9126c506d176fbd3163">00427</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <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> ) |
307 | | <a name="l00428"></a>00428 { |
308 | | <a name="l00429"></a>00429 assert_type(element,Setting::TypeGroup); |
309 | | <a name="l00430"></a>00430 Setting &list = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeList ) |
310 | | <a name="l00431"></a>00431 : element.add( name, Setting::TypeList ); |
311 | | <a name="l00432"></a>00432 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<array_to_save.length(); i++ ) |
312 | | <a name="l00433"></a>00433 <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( array_to_save(i), list ); |
313 | | <a name="l00434"></a>00434 } |
314 | | <a name="l00435"></a>00435 |
315 | | <a name="l00437"></a>00437 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> mat &matrix, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
316 | | <a name="l00438"></a>00438 |
317 | | <a name="l00440"></a>00440 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> ivec &vec, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
318 | | <a name="l00441"></a>00441 |
319 | | <a name="l00443"></a>00443 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> vec &vector, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
320 | | <a name="l00444"></a>00444 |
321 | | <a name="l00446"></a>00446 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &str, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
322 | | <a name="l00447"></a>00447 |
323 | | <a name="l00449"></a>00449 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">int</span> &integer, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
324 | | <a name="l00450"></a>00450 |
325 | | <a name="l00452"></a>00452 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">double</span> &real, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
326 | | <a name="l00454"></a>00454 |
327 | | <a name="l00455"></a>00455 }; |
328 | | <a name="l00456"></a>00456 |
| 116 | <a name="l00078"></a>00078 |
| 117 | <a name="l00101"></a><a class="code" href="classbdm_1_1UIFile.html">00101</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> : <span class="keyword">public</span> Config |
| 118 | <a name="l00102"></a>00102 { |
| 119 | <a name="l00103"></a>00103 <span class="keyword">public</span>: |
| 120 | <a name="l00105"></a>00105 <a class="code" href="classbdm_1_1UIFile.html#77274c827f87f16bd6671df8a0cc1e33" title="Create empty file instance prepared to store Settings.">UIFile</a>(); |
| 121 | <a name="l00106"></a>00106 |
| 122 | <a name="l00108"></a>00108 <a class="code" href="classbdm_1_1UIFile.html#77274c827f87f16bd6671df8a0cc1e33" title="Create empty file instance prepared to store Settings.">UIFile</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &file_name ); |
| 123 | <a name="l00109"></a>00109 |
| 124 | <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UIFile.html#1f8af28a0d8ef1a4956e198df0beb5ba" title="Save all the stored Settings into the configuration file file_name.">save</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &file_name); |
| 125 | <a name="l00112"></a>00112 |
| 126 | <a name="l00114"></a>00114 <a class="code" href="classbdm_1_1UIFile.html#5bce10d88c71f6147d58baa8400ff61f" title="This operator allows the ability of substituting Setting parameter by UIFile instance...">operator Setting&</a>(); |
| 127 | <a name="l00115"></a>00115 }; |
| 128 | <a name="l00116"></a>00116 |
| 129 | <a name="l00181"></a><a class="code" href="classbdm_1_1SettingResolver.html">00181</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> : <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> |
| 130 | <a name="l00182"></a>00182 { |
| 131 | <a name="l00183"></a>00183 <span class="keyword">private</span>: |
| 132 | <a name="l00185"></a>00185 <a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a> *file; |
| 133 | <a name="l00186"></a>00186 |
| 134 | <a name="l00192"></a>00192 <span class="keyword">const</span> Setting &initialize_reference( <a class="code" href="classbdm_1_1UIFile.html" title="This class serves to load and/or save user-infos into/from configuration files stored...">UIFile</a>* &file, <span class="keyword">const</span> Setting &potential_link); |
| 135 | <a name="l00193"></a>00193 |
| 136 | <a name="l00194"></a>00194 <span class="keyword">public</span>: |
| 137 | <a name="l00196"></a><a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498">00196</a> <span class="keyword">const</span> Setting &<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>; |
| 138 | <a name="l00197"></a>00197 |
| 139 | <a name="l00199"></a>00199 <a class="code" href="classbdm_1_1SettingResolver.html#e2299746b95bf8af54a867aaf52fc8da" title="If potential_link contains a link to some other setting, it is resolved here. Anyway...">SettingResolver</a>( <span class="keyword">const</span> Setting &potential_link ); |
| 140 | <a name="l00200"></a>00200 |
| 141 | <a name="l00202"></a>00202 <a class="code" href="classbdm_1_1SettingResolver.html#c8b29999710e2db98c1a3979e25e6bbc" title="An opened UIFile file is closed here if necessary.">~SettingResolver</a>(); |
| 142 | <a name="l00203"></a>00203 }; |
| 143 | <a name="l00204"></a>00204 |
| 144 | <a name="l00212"></a><a class="code" href="classbdm_1_1UI.html">00212</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a> |
| 145 | <a name="l00213"></a>00213 { |
| 146 | <a name="l00214"></a>00214 <span class="keyword">private</span>: |
| 147 | <a name="l00220"></a>00220 <span class="keyword">class </span>MappedUI |
| 148 | <a name="l00221"></a>00221 { |
| 149 | <a name="l00222"></a>00222 <span class="keyword">private</span>: |
| 150 | <a name="l00224"></a>00224 <span class="keyword">typedef</span> map< const string, const UI* const > StringToUIMap; |
| 151 | <a name="l00225"></a>00225 |
| 152 | <a name="l00227"></a>00227 <span class="keyword">typedef</span> map< const type_info * const, const string > TypeInfoToStringMap; |
| 153 | <a name="l00228"></a>00228 |
| 154 | <a name="l00230"></a>00230 <span class="keyword">static</span> StringToUIMap& mapped_strings(); |
| 155 | <a name="l00231"></a>00231 |
| 156 | <a name="l00233"></a>00233 <span class="keyword">static</span> TypeInfoToStringMap& mapped_type_infos(); |
| 157 | <a name="l00234"></a>00234 |
| 158 | <a name="l00236"></a>00236 <span class="keyword">static</span> <span class="keywordtype">void</span> unregistered_class_error( <span class="keyword">const</span> <span class="keywordtype">string</span> &unregistered_class_name ); |
| 159 | <a name="l00237"></a>00237 |
| 160 | <a name="l00238"></a>00238 <span class="keyword">public</span>: |
| 161 | <a name="l00240"></a>00240 <span class="keyword">static</span> <span class="keywordtype">void</span> add_class( <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, <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>* <span class="keyword">const</span> ui ); |
| 162 | <a name="l00241"></a>00241 |
| 163 | <a name="l00243"></a>00243 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>& retrieve_ui( <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name ); |
| 164 | <a name="l00244"></a>00244 |
| 165 | <a name="l00246"></a>00246 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">string</span>& retrieve_class_name( <span class="keyword">const</span> type_info* <span class="keyword">const</span> class_type_info ); |
| 166 | <a name="l00247"></a>00247 }; |
| 167 | <a name="l00248"></a>00248 |
| 168 | <a name="l00250"></a>00250 <span class="keyword">static</span> <span class="keywordtype">void</span> assert_type( <span class="keyword">const</span> Setting &element, Setting::Type type); |
| 169 | <a name="l00251"></a>00251 |
| 170 | <a name="l00253"></a>00253 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a>* new_instance() <span class="keyword">const</span> = 0; |
| 171 | <a name="l00254"></a>00254 |
| 172 | <a name="l00256"></a>00256 <span class="keyword">static</span> <span class="keyword">const</span> Setting& to_child_setting( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ); |
| 173 | <a name="l00257"></a>00257 |
| 174 | <a name="l00259"></a>00259 <span class="keyword">static</span> <span class="keyword">const</span> Setting& to_child_setting( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ); |
| 175 | <a name="l00260"></a>00260 |
| 176 | <a name="l00262"></a>00262 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( mat& matrix, <span class="keyword">const</span> Setting &element ); |
| 177 | <a name="l00264"></a>00264 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( ivec &vector, <span class="keyword">const</span> Setting &element ); |
| 178 | <a name="l00266"></a>00266 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">string</span> &<a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs - TODO tak proc je ve verejnem...">str</a>, <span class="keyword">const</span> Setting &element ); |
| 179 | <a name="l00268"></a>00268 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( vec &vector, <span class="keyword">const</span> Setting &element ); |
| 180 | <a name="l00270"></a>00270 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">int</span> &integer, <span class="keyword">const</span> Setting &element ); |
| 181 | <a name="l00272"></a>00272 <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( <span class="keywordtype">double</span> &real, <span class="keyword">const</span> Setting &element ); |
| 182 | <a name="l00274"></a>00274 <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> from_setting( T* &instance, <span class="keyword">const</span> Setting &element ) |
| 183 | <a name="l00275"></a>00275 { |
| 184 | <a name="l00276"></a>00276 <span class="keyword">const</span> <a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> link( element ); |
| 185 | <a name="l00277"></a>00277 assert_type(link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>,Setting::TypeGroup); |
| 186 | <a name="l00278"></a>00278 |
| 187 | <a name="l00279"></a>00279 <span class="comment">// we get a value stored in the "class" attribute </span> |
| 188 | <a name="l00280"></a>00280 <span class="keywordtype">string</span> class_name; |
| 189 | <a name="l00281"></a>00281 <span class="keywordflow">if</span>( !link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>.lookupValue( <span class="stringliteral">"class"</span>, class_name ) ) |
| 190 | <a name="l00282"></a>00282 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the obligatory \"class\" identifier is missing"</span>, link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
| 191 | <a name="l00283"></a>00283 |
| 192 | <a name="l00284"></a>00284 <span class="comment">// then we find a user-info related to this type</span> |
| 193 | <a name="l00285"></a>00285 <span class="keyword">const</span> <a class="code" href="classbdm_1_1UI.html" title="UI is an abstract class and it is intended for internal purposes only.">UI</a>& related_UI = MappedUI::retrieve_ui( class_name ); |
| 194 | <a name="l00286"></a>00286 |
| 195 | <a name="l00287"></a>00287 <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a>* typeless_instance = related_UI.<a class="code" href="classbdm_1_1UI.html#77291f28a4b951522ae5f6a03121b635" title="Method assembling a typeless instance, it is implemented in descendant class ParticularUI&lt;T&gt;...">new_instance</a>(); |
| 196 | <a name="l00288"></a>00288 |
| 197 | <a name="l00289"></a>00289 instance = <span class="keyword">dynamic_cast<</span>T*<span class="keyword">></span>(typeless_instance); |
| 198 | <a name="l00290"></a>00290 <span class="keywordflow">if</span> (!instance) |
| 199 | <a name="l00291"></a>00291 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"class "</span> + class_name + <span class="stringliteral">" is not a descendant of the desired output class. Try to call the UI::build<T> function with a different type parameter."</span>, link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
| 200 | <a name="l00292"></a>00292 |
| 201 | <a name="l00293"></a>00293 <span class="keywordflow">try</span> |
| 202 | <a name="l00294"></a>00294 { |
| 203 | <a name="l00295"></a>00295 instance->from_setting( link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a> ); |
| 204 | <a name="l00296"></a>00296 } |
| 205 | <a name="l00297"></a>00297 <span class="keywordflow">catch</span>(SettingException xcptn) |
| 206 | <a name="l00298"></a>00298 { |
| 207 | <a name="l00299"></a>00299 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the method "</span> + class_name + <span class="stringliteral">".from_setting(Setting&) has thrown an SettingException. Try to correct this method"</span>, xcptn.getPath()); |
| 208 | <a name="l00300"></a>00300 } |
| 209 | <a name="l00301"></a>00301 } |
| 210 | <a name="l00302"></a>00302 |
| 211 | <a name="l00304"></a>00304 <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 ) |
| 212 | <a name="l00305"></a>00305 { |
| 213 | <a name="l00306"></a>00306 <span class="keyword">const</span> <a class="code" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">SettingResolver</a> link( element ); |
| 214 | <a name="l00307"></a>00307 |
| 215 | <a name="l00308"></a>00308 assert_type(link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>,Setting::TypeList); |
| 216 | <a name="l00309"></a>00309 |
| 217 | <a name="l00310"></a>00310 <span class="keywordtype">int</span> len = link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>.getLength(); |
| 218 | <a name="l00311"></a>00311 array_to_load.set_length( len ); |
| 219 | <a name="l00312"></a>00312 <span class="keywordflow">if</span>( len == 0 ) <span class="keywordflow">return</span>; |
| 220 | <a name="l00313"></a>00313 |
| 221 | <a name="l00314"></a>00314 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i < len; i++ ) |
| 222 | <a name="l00315"></a>00315 from_setting( array_to_load(i), link.<a class="code" href="classbdm_1_1SettingResolver.html#adfcd0a81d025c52c8335b6aea07b498" title="Reference to a resolved link or to the original Setting in the case it does not contain...">result</a>[i] ); |
| 223 | <a name="l00316"></a>00316 } |
| 224 | <a name="l00317"></a>00317 |
| 225 | <a name="l00318"></a>00318 <span class="keyword">protected</span>: |
| 226 | <a name="l00320"></a><a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8">00320</a> <a class="code" href="classbdm_1_1UI.html#d60234c0673f345424329894b9b0cef8" title="Default constructor for internal use only, see.">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 ) |
| 227 | <a name="l00321"></a>00321 { |
| 228 | <a name="l00322"></a>00322 MappedUI::add_class( class_name, class_type_info, <span class="keyword">this</span> ); |
| 229 | <a name="l00323"></a>00323 } |
| 230 | <a name="l00324"></a>00324 |
| 231 | <a name="l00325"></a>00325 <span class="keyword">public</span>: |
| 232 | <a name="l00326"></a>00326 |
| 233 | <a name="l00330"></a>00330 |
| 234 | <a name="l00332"></a><a class="code" href="classbdm_1_1UI.html#dda27449f8bd19d54db9ccfb2644e908">00332</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name ) |
| 235 | <a name="l00333"></a>00333 { |
| 236 | <a name="l00334"></a>00334 T* instance; |
| 237 | <a name="l00335"></a>00335 from_setting<T>( instance, to_child_setting( element, name ) ); |
| 238 | <a name="l00336"></a>00336 <span class="keywordflow">return</span> instance; |
| 239 | <a name="l00337"></a>00337 } |
| 240 | <a name="l00339"></a><a class="code" href="classbdm_1_1UI.html#f0eccc7bbe4b680f3e1cb84b455a1125">00339</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element, <span class="keyword">const</span> <span class="keywordtype">int</span> index ) |
| 241 | <a name="l00340"></a>00340 { |
| 242 | <a name="l00341"></a>00341 T* instance; |
| 243 | <a name="l00342"></a>00342 from_setting<T>( instance, to_child_setting( element, index ) ); |
| 244 | <a name="l00343"></a>00343 <span class="keywordflow">return</span> instance; |
| 245 | <a name="l00344"></a>00344 } |
| 246 | <a name="l00346"></a><a class="code" href="classbdm_1_1UI.html#6e2da6a142fecf5f21e0bb86a7211cb4">00346</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#dda27449f8bd19d54db9ccfb2644e908" title="The new instance of type T* is constructed and initialized with values stored in...">build</a>( <span class="keyword">const</span> Setting &element ) |
| 247 | <a name="l00347"></a>00347 { |
| 248 | <a name="l00348"></a>00348 T* instance; |
| 249 | <a name="l00349"></a>00349 from_setting<T>( instance, element ); |
| 250 | <a name="l00350"></a>00350 <span class="keywordflow">return</span> instance; |
| 251 | <a name="l00351"></a>00351 } |
| 252 | <a name="l00353"></a>00353 |
| 253 | <a name="l00357"></a>00357 |
| 254 | <a name="l00359"></a><a class="code" href="classbdm_1_1UI.html#652bfd23f5052e4f1cb317057d74a3e2">00359</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 ) |
| 255 | <a name="l00360"></a>00360 { |
| 256 | <a name="l00361"></a>00361 from_setting( instance, to_child_setting( element, name ) ); |
| 257 | <a name="l00362"></a>00362 } |
| 258 | <a name="l00363"></a>00363 |
| 259 | <a name="l00365"></a><a class="code" href="classbdm_1_1UI.html#3d04bb3d7dbcf0da0b4d5d3d5b7df51a">00365</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 ) |
| 260 | <a name="l00366"></a>00366 { |
| 261 | <a name="l00367"></a>00367 from_setting( instance, to_child_setting( element, index ) ); |
| 262 | <a name="l00368"></a>00368 } |
| 263 | <a name="l00369"></a>00369 |
| 264 | <a name="l00371"></a><a class="code" href="classbdm_1_1UI.html#25747ac6d0232aa7102dbb316f65ddce">00371</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 ) |
| 265 | <a name="l00372"></a>00372 { |
| 266 | <a name="l00373"></a>00373 from_setting( instance, element ); |
| 267 | <a name="l00374"></a>00374 } |
| 268 | <a name="l00376"></a>00376 |
| 269 | <a name="l00380"></a>00380 |
| 270 | <a name="l00382"></a><a class="code" href="classbdm_1_1UI.html#00bb5f2a328d272b0a3ffbda1a902d54">00382</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 ) |
| 271 | <a name="l00383"></a>00383 { |
| 272 | <a name="l00384"></a>00384 from_setting( array_to_load, to_child_setting( element, name ) ); |
| 273 | <a name="l00385"></a>00385 } |
| 274 | <a name="l00386"></a>00386 |
| 275 | <a name="l00388"></a><a class="code" href="classbdm_1_1UI.html#b6a224b6aea027e167d3d565b39144e0">00388</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 ) |
| 276 | <a name="l00389"></a>00389 { |
| 277 | <a name="l00390"></a>00390 from_setting( array_to_load, to_child_setting( element, index ) ); |
| 278 | <a name="l00391"></a>00391 } |
| 279 | <a name="l00392"></a>00392 |
| 280 | <a name="l00394"></a><a class="code" href="classbdm_1_1UI.html#4fc5efdc58e4e184218b6d5beeb5ceab">00394</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 ) |
| 281 | <a name="l00395"></a>00395 { |
| 282 | <a name="l00396"></a>00396 from_setting( array_to_load, element ); |
| 283 | <a name="l00397"></a>00397 } |
| 284 | <a name="l00399"></a>00399 |
| 285 | <a name="l00404"></a>00404 |
| 286 | <a name="l00406"></a><a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917">00406</a> <span class="keyword">template</span>< <span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <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>) |
| 287 | <a name="l00407"></a>00407 { |
| 288 | <a name="l00408"></a>00408 Setting &<span class="keyword">set</span> = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeGroup ) |
| 289 | <a name="l00409"></a>00409 : element.add( name, Setting::TypeGroup ); |
| 290 | <a name="l00410"></a>00410 |
| 291 | <a name="l00411"></a>00411 <span class="keyword">const</span> <span class="keywordtype">string</span> &class_name = MappedUI::retrieve_class_name( &<span class="keyword">typeid</span>(*instance) ); |
| 292 | <a name="l00412"></a>00412 |
| 293 | <a name="l00413"></a>00413 <span class="comment">// add attribute "class" </span> |
| 294 | <a name="l00414"></a>00414 Setting &type = <span class="keyword">set</span>.add( <span class="stringliteral">"class"</span>, Setting::TypeString ); |
| 295 | <a name="l00415"></a>00415 type = class_name; |
| 296 | <a name="l00416"></a>00416 |
| 297 | <a name="l00417"></a>00417 <span class="keywordflow">try</span> |
| 298 | <a name="l00418"></a>00418 { |
| 299 | <a name="l00419"></a>00419 instance->to_setting( <span class="keyword">set</span> ); |
| 300 | <a name="l00420"></a>00420 } |
| 301 | <a name="l00421"></a>00421 <span class="keywordflow">catch</span>(SettingException xcptn) |
| 302 | <a name="l00422"></a>00422 { |
| 303 | <a name="l00423"></a>00423 <span class="keywordflow">throw</span> <a class="code" href="classbdm_1_1UIException.html" title="Exception prepared for reporting user-info errors which are always related to some...">UIException</a>( <span class="stringliteral">"the method "</span> + class_name + <span class="stringliteral">".to_setting(Setting&) has thrown an SettingException. Try to correct this method"</span>, xcptn.getPath()); |
| 304 | <a name="l00424"></a>00424 } |
| 305 | <a name="l00425"></a>00425 } |
| 306 | <a name="l00426"></a>00426 |
| 307 | <a name="l00428"></a><a class="code" href="classbdm_1_1UI.html#4514f93573a9d9126c506d176fbd3163">00428</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <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> ) |
| 308 | <a name="l00429"></a>00429 { |
| 309 | <a name="l00430"></a>00430 assert_type(element,Setting::TypeGroup); |
| 310 | <a name="l00431"></a>00431 Setting &list = (name == <span class="stringliteral">""</span>) ? element.add( Setting::TypeList ) |
| 311 | <a name="l00432"></a>00432 : element.add( name, Setting::TypeList ); |
| 312 | <a name="l00433"></a>00433 <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i<array_to_save.length(); i++ ) |
| 313 | <a name="l00434"></a>00434 <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( array_to_save(i), list ); |
| 314 | <a name="l00435"></a>00435 } |
| 315 | <a name="l00436"></a>00436 |
| 316 | <a name="l00438"></a>00438 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> mat &matrix, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 317 | <a name="l00439"></a>00439 |
| 318 | <a name="l00441"></a>00441 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> ivec &vec, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 319 | <a name="l00442"></a>00442 |
| 320 | <a name="l00444"></a>00444 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> vec &vector, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 321 | <a name="l00445"></a>00445 |
| 322 | <a name="l00447"></a>00447 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">string</span> &str, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 323 | <a name="l00448"></a>00448 |
| 324 | <a name="l00450"></a>00450 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">int</span> &integer, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 325 | <a name="l00451"></a>00451 |
| 326 | <a name="l00453"></a>00453 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">save</a>( <span class="keyword">const</span> <span class="keywordtype">double</span> &real, Setting &element, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ); |
| 327 | <a name="l00455"></a>00455 |
| 328 | <a name="l00456"></a>00456 }; |