Show
Ignore:
Timestamp:
08/16/09 18:14:04 (15 years ago)
Author:
smidl
Message:

Documentation regenerated

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/html/ui_page.html

    r472 r538  
    55<link href="doxygen.css" rel="stylesheet" type="text/css"> 
    66</head><body> 
    7 <!-- Generated by Doxygen 1.5.9 --> 
     7<!-- Generated by Doxygen 1.5.8 --> 
    88<script type="text/javascript"> 
    99<!-- 
     
    7878}; 
    7979</pre></div> The exact meaning of the root fields in this structure (i.e. <code>ndat</code> and <code>prior</code>) is defined by the application (or mex file) that is using this configuration file. It will look for expected fields and it will ignore any other structures. When it does not find what it is looking for, it terminates with an appropriate error message.<p> 
    80 A structure with field <code>class="identifier"</code> is special. Such a structure will be parsed by an appropriate <a class="el" href="classbdm_1_1UI.html#970297d6c758692135877dfa7a5eacb0">bdm::UI::build</a> method which will construct the desired object, in this instance of an object of the class <a class="el" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">bdm::enorm</a>.<p> 
     80A structure with field <code>class="identifier"</code> is special. Such a structure will be parsed by an appropriate <a class="el" href="classbdm_1_1UI.html#1f3d45184f803e1256cfc896b43ed2f8">bdm::UI::build</a> method which will construct the desired object, in this instance of an object of the class <a class="el" href="classbdm_1_1enorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">bdm::enorm</a>.<p> 
    8181For a detailed example how this mechanism works in practice see <a class="el" href="arx_ui.html">Running experiment <code>estimator</code> with ARX data fields</a>. To learn about the possinility of making <b> internal or external links</b> in configuration files, see the documentation of <a class="el" href="classbdm_1_1SettingResolver.html" title="This class serves to expand links used within configuration files.">bdm::SettingResolver</a>.<h2><a class="anchor" name="ui_implementation"> 
    8282Implementation of user info in a custom class</a></h2> 
     
    9393There are few obligatory steps to implement user info mechanism in this class. At first, the class has to be <b>inherited</b> (directly or indirectly) from <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a>, as you can see in our example. What is hidden behind the scene is the use of a <b>parameterless constructor.</b> Each class using User infos has to have one.<p> 
    9494Next, <b>two virtual methods</b> <a class="el" href="classbdm_1_1root.html#0551e3121091c5199bf4413b50522176" title="This method arrange instance properties according the data stored in the Setting...">bdm::root::from_setting</a> and <a class="el" href="classbdm_1_1root.html#67d954d255ede776eade7334d4895790" title="This method save all the instance properties into the Setting structure.">bdm::root::to_setting</a> defined in the <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a> class <b>should be overriden </b> in accordance with the content of the current class. In fact, you can override just method <a class="el" href="classbdm_1_1root.html#0551e3121091c5199bf4413b50522176" title="This method arrange instance properties according the data stored in the Setting...">bdm::root::from_setting</a> in the case you are interested only in loading from configuration files, which is quite common. It is valid also in the other way round, i.e., in the case you are interested just in saving, override only <a class="el" href="classbdm_1_1root.html#67d954d255ede776eade7334d4895790" title="This method save all the instance properties into the Setting structure.">bdm::root::to_setting</a>.<p> 
    95 How should look the bodies of these methods? It is important not to forget to call their <b>implementation in the base class</b> (in our case, it is the <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a> class). Then, they should contain loading of all the necessary class attributes in the case of <a class="el" href="classbdm_1_1root.html#0551e3121091c5199bf4413b50522176" title="This method arrange instance properties according the data stored in the Setting...">bdm::root::from_setting</a> method and saving of them in the other case. To implement these operation, you are encouraged to use static methods of <a class="el" href="classbdm_1_1UI.html" title="UI is an abstract class which collects all the auxiliary functions useful to prepare...">bdm::UI</a> class, namely <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a>, <a class="el" href="classbdm_1_1UI.html#970297d6c758692135877dfa7a5eacb0">bdm::UI::build</a> and <a class="el" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">bdm::UI::save</a>.<p> 
     95How should look the bodies of these methods? It is important not to forget to call their <b>implementation in the base class</b> (in our case, it is the <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a> class). Then, they should contain loading of all the necessary class attributes in the case of <a class="el" href="classbdm_1_1root.html#0551e3121091c5199bf4413b50522176" title="This method arrange instance properties according the data stored in the Setting...">bdm::root::from_setting</a> method and saving of them in the other case. To implement these operation, you are encouraged to use static methods of <a class="el" href="classbdm_1_1UI.html" title="UI is an abstract class which collects all the auxiliary functions useful to prepare...">bdm::UI</a> class, namely <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a>, <a class="el" href="classbdm_1_1UI.html#1f3d45184f803e1256cfc896b43ed2f8">bdm::UI::build</a> and <a class="el" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">bdm::UI::save</a>.<p> 
    9696It can look like this:<p> 
    9797<div class="fragment"><pre class="fragment"><span class="keyword">class </span>newbee : <span class="keyword">public</span> bdm::root {   
     
    119119} 
    120120</pre></div><p> 
    121 As you can see, the presence of a concrete Setting in the configuration file can be tested by the return value of these methods and the code initializing the default values can follow immediately. Imagine, for example, that the first attribute <code>ndat</code> is optional. Thereore, the default value is filled in the case that there is not any other in the configuration file (and so <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method returs <code>false</code>). The second atribute, <code>prior</code>, is intended to be compulsory. This fact is specified by the last parameter of the templated <a class="el" href="classbdm_1_1UI.html#970297d6c758692135877dfa7a5eacb0">bdm::UI::build</a> method. In this case, the method throws an exception if there is not proper data in the configuration file.<p> 
    122 The only difference between <a class="el" href="classbdm_1_1UI.html#970297d6c758692135877dfa7a5eacb0">bdm::UI::build</a> and <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method is in the types of variables they are prepared to. The <a class="el" href="classbdm_1_1UI.html#970297d6c758692135877dfa7a5eacb0">bdm::UI::build&lt;T&gt;</a> method is used to initialize instances of classes derived from <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a>. It allocates them dynamically and return just an pointer to the new instance. This way it is possible even to load instances of inherited classes without aneven knowing about it. Oppositely, all scalar values of types int, double, string, vec, ivec or mat are loaded by the <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method with a static memory management. It is also capable to load arrays of templated type itpp::Array&lt;T&gt;.<p> 
     121As you can see, the presence of a concrete Setting in the configuration file can be tested by the return value of these methods and the code initializing the default values can follow immediately. Imagine, for example, that the first attribute <code>ndat</code> is optional. Thereore, the default value is filled in the case that there is not any other in the configuration file (and so <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method returs <code>false</code>). The second atribute, <code>prior</code>, is intended to be compulsory. This fact is specified by the last parameter of the templated <a class="el" href="classbdm_1_1UI.html#1f3d45184f803e1256cfc896b43ed2f8">bdm::UI::build</a> method. In this case, the method throws an exception if there is not proper data in the configuration file.<p> 
     122The only difference between <a class="el" href="classbdm_1_1UI.html#1f3d45184f803e1256cfc896b43ed2f8">bdm::UI::build</a> and <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method is in the types of variables they are prepared to. The <a class="el" href="classbdm_1_1UI.html#1f3d45184f803e1256cfc896b43ed2f8">bdm::UI::build&lt;T&gt;</a> method is used to initialize instances of classes derived from <a class="el" href="classbdm_1_1root.html" title="Root class of BDM objects.">bdm::root</a>. It allocates them dynamically and return just an pointer to the new instance. This way it is possible even to load instances of inherited classes without aneven knowing about it. Oppositely, all scalar values of types int, double, string, vec, ivec or mat are loaded by the <a class="el" href="classbdm_1_1UI.html#cd1667e6fec99ec64dabcb3ca2ff922d">bdm::UI::get</a> method with a static memory management. It is also capable to load arrays of templated type itpp::Array&lt;T&gt;.<p> 
    123123Saving is much more easier. For all the variable types, use the <a class="el" href="classbdm_1_1UI.html#c83987949e6a9e79d6e093797ab7d917" title="A root descendant instance is stored in the new child Setting appended to the passed...">bdm::UI::save</a> method. </div> 
    124 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Aug 5 00:06:51 2009 for mixpp by&nbsp; 
     124<hr size="1"><address style="text-align: right;"><small>Generated on Sun Aug 16 17:58:18 2009 for mixpp by&nbsp; 
    125125<a href="http://www.doxygen.org/index.html"> 
    126 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> 
     126<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> 
    127127</body> 
    128128</html>