Index: /library/bdm/estim/arx.h
===================================================================
--- /library/bdm/estim/arx.h (revision 384)
+++ /library/bdm/estim/arx.h (revision 471)
@@ -142,5 +142,4 @@
 	void from_setting( const Setting &set );
 
-	// TODO dodelat void to_setting( Setting &set ) const;
 };
 
Index: /library/bdm/estim/kalman.cpp
===================================================================
--- /library/bdm/estim/kalman.cpp (revision 384)
+++ /library/bdm/estim/kalman.cpp (revision 471)
@@ -251,26 +251,19 @@
 
 void EKFCh::from_setting( const Setting &set ) 
-{	
-	diffbifn* IM = UI::build<diffbifn>(set, "IM");
-	diffbifn* OM = UI::build<diffbifn>(set, "OM");
+{		
+	diffbifn* IM = UI::build<diffbifn>(set, "IM", UI::compulsory);
+	diffbifn* OM = UI::build<diffbifn>(set, "OM", UI::compulsory);
 	
 	//statistics
 	int dim=IM->dimension();
 	vec mu0;
-	if(set.exists("mu0"))
-		UI::get( mu0, set, "mu0");
-	else
+	if(!UI::get( mu0, set, "mu0"))
 		mu0=zeros(dim);
 
 	mat P0;
-	if(set.exists("dP0"))
-	{
-		vec dP0;
-		UI::get( dP0, set, "dP0");
+	vec dP0;
+	if(UI::get( dP0, set, "dP0"))
 		P0=diag(dP0);
-	}
-	else if ( set.exists( "P0" ) )
-		UI::get(P0, set, "P0");
-	else
+	else if ( !UI::get(P0, set, "P0") )
 		P0=eye(dim);
 	
@@ -278,15 +271,29 @@
 	
 	//parameters
-	vec dQ, dR;
-	UI::get( dQ, set, "dQ");
-	UI::get( dR, set, "dR");
+	vec dQ, dR;	
+	UI::get( dQ, set, "dQ", UI::compulsory);
+	UI::get( dR, set, "dR", UI::compulsory);
 	set_parameters(IM, OM, diag(dQ), diag(dR));
 
 	//connect
-	RV* drv = UI::build<RV>(set, "drv");
+	RV* drv = UI::build<RV>(set, "drv", UI::compulsory);
 	set_drv(*drv);
-	RV* rv = UI::build<RV>(set, "rv");
+	RV* rv = UI::build<RV>(set, "rv", UI::compulsory);
 	set_rv(*rv);
 	
+	string options;
+	if( UI::get( options, set, "options" ) )
+		set_options(options);	
+}
+
+void MultiModel::from_setting( const Setting &set ) 
+{	
+	Array<EKFCh*> A;
+	UI::get( A, set, "models", UI::compulsory);
+	
+	set_parameters(A);
+	set_drv(A(0)->_drv());
+	//set_rv(A(0)->_rv());
+
 	string options;
 	if(set.lookupValue( "options", options ))
@@ -294,38 +301,3 @@
 }
 
-/*void EKFCh::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-void MultiModel::from_setting( const Setting &set ) 
-{	
-	Array<EKFCh*> A;
-	UI::get( A, set, "models");
-	
-	set_parameters(A);
-	set_drv(A(0)->_drv());
-	//set_rv(A(0)->_rv());
-
-	string options;
-	if(set.lookupValue( "options", options ))
-		set_options(options);	
-}
-
-/*void MultiModel::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-
-}
+}
Index: /library/bdm/estim/arx.cpp
===================================================================
--- /library/bdm/estim/arx.cpp (revision 412)
+++ /library/bdm/estim/arx.cpp (revision 471)
@@ -196,6 +196,6 @@
 void ARX::from_setting( const Setting &set ) 
 {	
-	RV *yrv = UI::build<RV>(set,"y");
-	RV *rrv = UI::build<RV>(set,"rgr");
+	RV *yrv = UI::build<RV>(set,"y", UI::compulsory);
+	RV *rrv = UI::build<RV>(set,"rgr", UI::compulsory);
 	int ylen = yrv->_dsize();
 	int rgrlen = rrv->_dsize();
@@ -204,17 +204,14 @@
 	mat V0;
 	vec dV0;
-	try {
-		UI::get( dV0, set, "dV0" );
-	} catch(...){
+	if( !UI::get( dV0, set, "dV0" ) )
 		dV0=concat ( 1e-3*ones ( ylen ), 1e-5*ones ( rgrlen ) );
-	}
 	V0=diag ( dV0 );
 	
 	double nu0;
-	if ( !set.lookupValue( "nu0", nu0 ) ) 
+	if ( !UI::get( nu0, set, "nu0") ) 
 		nu0 = rgrlen+ylen+2;
 
 	double frg;
-	if ( !set.lookupValue( "frg", frg ) ) 
+	if ( !UI::get( frg, set, "frg") ) 
 		frg = 1.0;
 
@@ -230,14 +227,3 @@
 }
 
-/*void ARX::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-
-}
+}
Index: /library/bdm/math/square_mat.h
===================================================================
--- /library/bdm/math/square_mat.h (revision 433)
+++ /library/bdm/math/square_mat.h (revision 471)
@@ -16,9 +16,4 @@
 
 #include "../itpp_ext.h"
-
-/*!
-\defgroup math Auxiliary math functions 
-@{
-*/
 
 using namespace itpp;
@@ -283,5 +278,3 @@
 inline ldmat& ldmat::operator -= ( const ldmat &ldA )  {this->add ( ldA,-1.0 );return *this;}
 
-/*! @} */
-
 #endif // DC_H
Index: /library/bdm/mex/mex_datasource.h
===================================================================
--- /library/bdm/mex/mex_datasource.h (revision 384)
+++ /library/bdm/mex/mex_datasource.h (revision 471)
@@ -34,12 +34,12 @@
 	{	
 		Data = mxArray2mat(mexGetVariable("base",set["varname"]));
-		UI::get( rowid, set, "rids" );
+		UI::get( rowid, set, "rids" , UI::compulsory);
 		it_assert_debug ( max ( rowid ) <=Data.rows(),"MemDS rowid is too high for given Dat." );
 
-		UI::get( delays, set, "tds" );
+		UI::get( delays, set, "tds", UI::compulsory );
 		time = max ( delays );
 		it_assert_debug ( time < Data.cols(),"MemDS delays are too high." );
 
-		RV* r = UI::build<RV>(set,"rv");
+		RV* r = UI::build<RV>(set,"rv", UI::compulsory);
 		RV ru=RV();
 		set_rvs(*r,ru);
Index: /library/bdm/base/user_info.h
===================================================================
--- /library/bdm/base/user_info.h (revision 417)
+++ /library/bdm/base/user_info.h (revision 471)
@@ -1,6 +1,7 @@
 /*!
   \file
-  \brief UI (user info) class for loading/saving objects from/to configuration files.  
+  \brief UI (user info) class for loading/saving objects from/to configuration files.
   It is designed with use of libconfig C/C++ Configuration File Library
+  \ref ui_page
   \author Vaclav Smidl.
 
@@ -30,46 +31,31 @@
 using namespace libconfig;
 
-namespace bdm
-{
-	
-/*!
-  \def UIREGISTER(class_name)
-  \brief Macro for registration of class into map of user-infos, registered class is scriptable using UI static methods
-  
-  Argument \a class_name has to be a descendant of root class and also, it has to have parameterless constructor prepared.
-  This macro should be used in header file, immediately after a class declaration.
-  
-  \sa TODO MODUL  
-*/
-#ifndef BDMLIB 
-	#define UIREGISTER(class_name) template<> const ParticularUI<class_name>& ParticularUI<class_name>::factory = ParticularUI<class_name>(#class_name) 
-#else
-	#define UIREGISTER(class_name)
-#endif
+namespace bdm {
 
 //! Exception prepared for reporting user-info errors which are always related to some concrete Setting path
-class UIException : public std::exception
-{
-private:
+//!
+//!  \ref ui_page
+class UIException : public std::exception {
+
+public:
 	//! Error message
 	const string message;
 
-public:
+	//! Path to the problematic setting
+	const string path;
+
 	//! Use this constructor when you can pass the problematical Setting as a parameter
-	UIException( const string &message, const Setting &element  ) 
-		: message( "UI error: " + message + ". Check path \"" + string(element.getPath()) + "\"." )
-	{
+	UIException ( const string &message, const Setting &element )
+			: message ( "UI error: " + message + "." ), path ( "Check path \"" + string ( element.getPath() ) + "\"." ) {
 	}
 
 	//! This constructor is for other occasions, when only path of problematical Setting is known
-	UIException( const string &message, const string &path  ) 
-		: message( "UI error: " + message + "! Check path \"" + path + "\"." )
-	{
+	UIException ( const string &message, const string &path )
+			: message ( "UI error: " + message + "." ), path ( "Check path \"" + path + "\"." ) {
 	}
 
 	//! Overriden method for reporting an error message
-	virtual const char* what() const throw()
-	{
-		return message.c_str();
+	virtual const char* what() const throw() {
+		return ( message + " " + path ).c_str();
 	}
 	~UIException() throw() {};
@@ -78,8 +64,8 @@
 
 /*!
-@brief This class serves to load and/or save user-infos into/from 
+@brief This class serves to load and/or save user-infos into/from
 configuration files stored on a hard-disk.
 
-Firstly, save some user-infos into the new UIFile instance. Then, 
+Firstly, save some user-infos into the new UIFile instance. Then,
 call the save method with a filename as its only argument:
 
@@ -91,5 +77,5 @@
 \endcode
 
-In the other way round, when loading object from a configuration file, 
+In the other way round, when loading object from a configuration file,
 the appropriate code looks like this:
 
@@ -98,7 +84,8 @@
 	CAudi *audi = UI::build<CAudi>(file,"TT");
 \endcode
+
+\ref ui_page
 */
-class UIFile : public Config
-{
+class UIFile : public Config {
 public:
 	//! Create empty file instance prepared to store Settings
@@ -106,8 +93,8 @@
 
 	//! Creates instance and fills it from the configuration file file_name
-	UIFile( const string &file_name );
+	UIFile ( const string &file_name );
 
 	//! Save all the stored Settings into the configuration file file_name
-	void save(const string &file_name);
+	void save ( const string &file_name );
 
 	//! This operator allows the ability of substituting Setting parameter by UIFile instance
@@ -116,13 +103,13 @@
 
 /*!
-@brief This class serves to expand links used within configuration files. 
+@brief This class serves to expand links used within configuration files.
 
 Value of any type but string can be linked to some other value of the same type
 defined elsewhere in the current configuration file or even in some different
-configuration file. 
-
-Link have three parts, \<name\> : \<path\> \<\@filename\>. Field \<name\> contains the 
+configuration file.
+
+Link have three parts, \<name\> : \<path\> \<\@filename\>. Field \<name\> contains the
 name of the new setting, \<path\> is the relative path to the referenced setting, which
-has to be taken from the %root Setting element. The last part \<\@filename\> is optional, 
+has to be taken from the %root Setting element. The last part \<\@filename\> is optional,
 it contains filename in the case the link should refer to a variable stored in a different
 file. From the previous part \<path\>, it has to be separated by '@'.
@@ -130,5 +117,5 @@
 \code
     ...
-	jardovo : 
+	jardovo :
 	{
 	  class = "Car";
@@ -137,5 +124,5 @@
 	  kilometers = 1555000;
 	};
-	ondrejovo : 
+	ondrejovo :
 	{
 	  class = "Bike";
@@ -145,12 +132,12 @@
 	  matr = ( 2, 2, [ 1.0, 0.0, 0.0, 1.0 ] );
 	};
-	
-	#this is the example of local link to another mean of transport 
+
+	#this is the example of local link to another mean of transport
 	elisky = "jardovo";
 
 	...
 
-	# and this link is external link pointing to file "other_cars.cfg" stored in the
-	# same directory, in that file, it refers to the local Setting "magic_cars.skubankovo"
+	# And this link is external link pointing to the file "other_cars.cfg" stored in the
+	# same directory. In that file, it refers to the local Setting "magic_cars.skubankovo".
 	kati = "magic_cars.skubankovo@other_cars.cfg";
 
@@ -172,13 +159,14 @@
 \endcode
 
-The whole point is that a resolved link (class member #result, i.e., "link.result" in the previous example) could point 
+The whole point is that a resolved link (class member #result, i.e., "link.result" in the previous example) could point
 into a different configuration file. In that case there has to be an UIFile instance managing reading from this
-file. As the libconfig::Config deletes all its Settings when dealocated, UIFile must not be dealocated until all 
-the necessary operation on the linked Setting are finished (otherwise, the link #result would be invalid just after 
-the UIFile dealocation). And that is exactly the mechanism implemented within SettingResolver class. It assures, 
+file. As the libconfig::Config deletes all its Settings when dealocated, UIFile must not be dealocated until all
+the necessary operation on the linked Setting are finished (otherwise, the link #result would be invalid just after
+the UIFile dealocation). And that is exactly the mechanism implemented within SettingResolver class. It assures,
 that the #result Setting reference is valid within the scope of SettingResolver instance.
+	
+\ref ui_page
  */
-class SettingResolver : root
-{
+class SettingResolver : root {
 private:
 	//! If necessary, this pointer stores an addres of an opened UIFile, else it equals NULL
@@ -187,8 +175,8 @@
 	//! This method initialize #result reference, i.e., it executes the main code of SettingResolver class
 	//!
-	//! This code could be also located directly in constructor. The only reason why we made this 
+	//! This code could be also located directly in constructor. The only reason why we made this
 	//! method is the keyword 'const' within the declaration of #result reference . Such a reference
 	//! have to be intialized before any other constructor command, exactly in the way it is implemented now.
-	const Setting &initialize_reference( UIFile* &file, const Setting &potential_link);
+	const Setting &initialize_reference ( UIFile* &file, const Setting &potential_link );
 
 public:
@@ -197,27 +185,28 @@
 
 	//! If potential_link contains a link to some other setting, it is resolved here. Anyway, the Setting reference #result is prepared for use.
-	SettingResolver( const Setting &potential_link );
-	
+	SettingResolver ( const Setting &potential_link );
+
 	//! An opened UIFile file is closed here if necessary.
-	~SettingResolver();		
+	~SettingResolver();
 };
 
 /*!
-@brief UI is an abstract class and it is intended for internal purposes only
-
-This class exists mainly to allow pointers to its templated descendant ParticularUI<T>. Next, 
-it collects all the auxiliary functions useful to prepare some concret user-infos, see static 
-methods 'build', 'get' and 'save'. 
+@brief UI is an abstract class which collects all the auxiliary functions useful to prepare some concrete
+user-infos.
+
+See static methods 'build', 'get' and 'save'. Writing user-infos with these methods is rather  simple. The
+rest of this class is intended for internal purposes only. Its meaning is to allow pointers to its templated
+descendant ParticularUI<T>.
+
+\ref ui_page
 */
-class UI 
-{
+class UI {
 private:
 	//! Class with state shared across all its instances ("monostate"), encapsulating two maps, one mapping names to UI instances and the other mapping type_infos to class names
-	//! 
+	//!
 	//! The key property of this class is that it initializes the internal maps on global init,
-	//! before the instance is used for a first time. Therefore, we do not have to care about initialization 
+	//! before the instance is used for a first time. Therefore, we do not have to care about initialization
 	//! during a call of UIREGISTER macro operating with both these mappings.
-	class MappedUI
-	{
+	class MappedUI {
 	private:
 		//! Type definition of mapping which transforms class names to the related UI instances
@@ -234,142 +223,202 @@
 
 		//! Method for reporting a error when an attempt to operate with an unregistered class occures
-		static void unregistered_class_error( const string &unregistered_class_name );
+		static void unregistered_class_error ( const string &unregistered_class_name );
 
 	public:
 		//! Add a pair key-userinfo into the internal map
-		static void add_class( const string &class_name, const type_info * const class_type_info, const UI* const ui );
+		static void add_class ( const string &class_name, const type_info * const class_type_info, const UI* const ui );
 
 		//! Search for an userinfo related to the passed class name within the internal map
-		static const UI& retrieve_ui( const string &class_name );
+		static const UI& retrieve_ui ( const string &class_name );
 
 		//! Search for an class name related to the passed type_info within the internal map
-		static const string& retrieve_class_name( const type_info* const class_type_info );
+		static const string& retrieve_class_name ( const type_info* const class_type_info );
 	};
 
 	//! Function assertting that the setting element is of the SettingType type
-	static void assert_type( const Setting &element, Setting::Type type);
+	static void assert_type ( const Setting &element, Setting::Type type );
 
 	//! Method assembling a typeless instance, it is implemented in descendant class ParticularUI<T>
 	virtual root* new_instance() const = 0;
-	
-   	//! Method switching from the \a element to its child Setting according the passed \a index, it also does all the necessary error-checking 
-	static const Setting& to_child_setting( const Setting &element, const int index );
-
-   	//! Method switching from the \a element to its child Setting according the passed \a name, it also does all the necessary error-checking 
-	static const Setting& to_child_setting( const Setting &element, const string &name );
-
-	//! This method converts a Setting into a matrix 
-	static void from_setting( mat& matrix, const Setting &element );	
+
+	//! Method switching from the \a element to its child Setting according the passed \a index, it also does all the necessary error-checking
+	static const Setting& to_child_setting ( const Setting &element, const int index );
+
+	//! Method switching from the \a element to its child Setting according the passed \a name, it also does all the necessary error-checking
+	static const Setting& to_child_setting ( const Setting &element, const string &name );
+
+	//! This method converts a Setting into a matrix
+	static void from_setting ( mat& matrix, const Setting &element );
 	//! This method converts a Setting into an integer vector
-	static void from_setting( ivec &vector, const Setting &element );
+	static void from_setting ( ivec &vector, const Setting &element );
 	//! This method converts a Setting into a string
-	static void from_setting( string &str, const Setting &element );
+	static void from_setting ( string &str, const Setting &element );
 	//! This method converts a Setting into a real vector
-	static void from_setting( vec &vector, const Setting &element );
-	//! This method converts a Setting into a integer scalar 
-	static void from_setting( int &integer, const Setting &element );
-	//! This method converts a Setting into a real scalar 
-	static void from_setting( double &real, const Setting &element );
+	static void from_setting ( vec &vector, const Setting &element );
+	//! This method converts a Setting into a integer scalar
+	static void from_setting ( int &integer, const Setting &element );
+	//! This method converts a Setting into a real scalar
+	static void from_setting ( double &real, const Setting &element );
 	//! This method converts a Setting into a class T descendant
-	template<class T> static void from_setting( T* &instance, const Setting &element )
-	{			
-		const SettingResolver link( element );
-		assert_type(link.result,Setting::TypeGroup);
-
-		// we get a value stored in the "class" attribute 
+	template<class T> static void from_setting ( T* &instance, const Setting &element ) {
+		const SettingResolver link ( element );
+		assert_type ( link.result, Setting::TypeGroup );
+
+		// we get a value stored in the "class" attribute
 		string class_name;
-		if( !link.result.lookupValue( "class", class_name ) )
-			throw UIException( "the obligatory \"class\" identifier is missing", link.result );
-	
+		if ( !link.result.lookupValue ( "class", class_name ) )
+			throw UIException ( "the obligatory \"class\" identifier is missing", link.result );
+
 		// then we find a user-info related to this type
-		const UI& related_UI = MappedUI::retrieve_ui( class_name );
-		
+		const UI& related_UI = MappedUI::retrieve_ui ( class_name );
+
 		root* typeless_instance = related_UI.new_instance();
 
-		instance = dynamic_cast<T*>(typeless_instance);
-		if (!instance)
-			throw UIException( "class " + class_name + " is not a descendant of the desired output class. Try to call the UI::build<T> function with a different type parameter.", link.result );
- 		
-		try
-		{
-			instance->from_setting( link.result );
+		instance = dynamic_cast<T*> ( typeless_instance );
+		if ( !instance )
+			throw UIException ( "class " + class_name + " is not a descendant of the desired output class. Try to call the UI::build<T> function with a different type parameter.", link.result );
+
+		try {
+			instance->from_setting ( link.result );
+		} catch ( SettingException sttng_xcptn ) {
+			string msg = "the method " + class_name + ".from_setting(Setting&) has thrown a SettingException. Try to correct this method. Check path \"" + sttng_xcptn.getPath() + "\".";
+			throw exception ( msg.c_str() );
+		} catch ( UIException uixcptn ) {
+			string msg = "the method " + class_name + ".from_setting(Setting&) has thrown an UIException \"" + uixcptn.message + "\" Try to correct this method. Check path \"" + uixcptn.path + "\".";
+			throw exception ( msg.c_str() );
+		} catch ( exception xcptn ) {
+			string msg = "the method " + class_name + ".from_setting(Setting&) has thrown a general exception \"" + xcptn.what() + "\" Try to correct this method. Check path \"" + element.getPath() + "\".";
+			throw exception ( msg.c_str() );
 		}
-		catch(SettingException xcptn)
-		{
-			throw UIException( "the method " + class_name + ".from_setting(Setting&) has thrown an SettingException. Try to correct this method", xcptn.getPath());
-		}
-	}	
+	}
 
 	//! This methods converts a Setting into a new templated array of type Array<T>
-	template<class T> static void from_setting( Array<T> &array_to_load, const Setting &element )
-	{
-		const SettingResolver link( element );
-
-		assert_type(link.result,Setting::TypeList);
+	template<class T> static void from_setting ( Array<T> &array_to_load, const Setting &element ) {
+		const SettingResolver link ( element );
+
+		assert_type ( link.result, Setting::TypeList );
 
 		int len = link.result.getLength();
-		array_to_load.set_length( len );
-		if( len == 0 ) return;
-		
-		for( int i=0; i < len; i++ ) 
-			from_setting( array_to_load(i), link.result[i] ); 
-	}
+		array_to_load.set_length ( len );
+		if ( len == 0 ) return;
+
+		for ( int i = 0; i < len; i++ )
+			from_setting ( array_to_load ( i ), link.result[i] );
+	}
+
+	//! This is dummy version of the from_setting method for other, unsupported types. It just throws an exception.
+	//!
+	//! At the moment, this is the only way how to compile the library without obtaining the compiler error c2665.
+	//! The exception can help to find the place where the template is misused and also to correct it.
+	template<class T> static void from_setting ( T &array_to_load, const Setting &element ) {
+		throw UIException( "from_setting is not implemented for this type", element );
+	}
+
 
 protected:
 	//! Default constructor for internal use only, see \sa ParticularUI<T>
-	UI( const string& class_name, const type_info * const class_type_info ) 
-	{	
-		MappedUI::add_class( class_name, class_type_info, this );
-	}
-
-public: 
-
-	//! \name Initialization of classes 
+	UI ( const string& class_name, const type_info * const class_type_info ) {
+		MappedUI::add_class ( class_name, class_type_info, this );
+	}
+
+public:
+
+	//! Enumerical type used to determine whether the data for concrete Settingis is compulsory or optional 
+	enum SettingPresence { optional, compulsory } ;
+
+	//! \name Initialization of classes
 	//!@{
-	//! The type T has to be a root descendant class
+	//! The type T has to be a #bdm::root descendant class
 
 	//! The new instance of type T* is constructed and initialized with values stored in the Setting element[name]
-	template<class T> static T* build( const Setting &element, const string &name )
-	{			
+	//!
+	//! If there is not any sub-element named #name, the null pointer is returned.
+	template<class T> static T* build ( const Setting &element, const string &name, SettingPresence settingPresence = optional ) {
+		if ( !element.exists ( name ) )
+		{
+			if( settingPresence == optional )
+				return NULL;
+			else
+				throw UIException ( "the compulsory Setting named \"" + name + "\" is missing", element );
+		}
+
 		T* instance;
-		from_setting<T>( instance, to_child_setting( element, name ) );
+		from_setting<T> ( instance, to_child_setting ( element, name ) );
 		return instance;
 	}
+
 	//! The new instance of type T* is constructed and initialized with values stored in the Setting element[index]
-	template<class T> static T* build( const Setting &element, const int index )
-	{
+	//!
+	//! If there is not any sub-element indexed by #index, the null pointer is returned.
+	template<class T> static T* build ( const Setting &element, const int index, SettingPresence settingPresence = optional ) {
+		if ( element.getLength() <= index )
+		{
+			if( settingPresence == optional )
+				return NULL;
+			else
+			{
+				stringstream stream;
+				stream << index;
+				throw UIException ( "the compulsory Setting with the index " + stream.str()+ " is missing", element );
+			}
+		}
+
 		T* instance;
-		from_setting<T>( instance, to_child_setting( element, index ) );
+		from_setting<T> ( instance, to_child_setting ( element, index ) );
 		return instance;
 	}
+
 	//! The new instance of type T* is constructed and initialized with values stored in the Setting element
-	template<class T> static T* build( const Setting &element )
-	{
+	template<class T> static T* build ( const Setting &element ) {
 		T* instance;
-		from_setting<T>( instance,  element );
+		from_setting<T> ( instance,  element );
 		return instance;
-	}
+
+	}
+
 	//!@}
 
-	//! \name Initialization of structures 
+	//! \name Initialization of structures
 	//!@{
 	//! The type T has to be int, double, string, vec, ivec or mat.
 
 	//! The existing instance of type T is initialized with values stored in the Setting element[name]
-	template<class T> static void get( T &instance, const Setting &element, const string &name )
-	{
-		from_setting( instance, to_child_setting( element, name ) );
-	}
-
-	//! The existing instance of type T is initialized with values stored in the Setting element[index] 
-	template<class T> static void get( T &instance, const Setting &element, const int index )
-	{
-		from_setting( instance, to_child_setting( element, index ) );
+	//! If there is not any sub-element named #name, this method returns false.
+	template<class T> static bool get ( T &instance, const Setting &element, const string &name, SettingPresence settingPresence = optional ) {
+		if ( !element.exists ( name ) )
+		{
+			if( settingPresence == optional )
+				return false;
+			else
+				throw UIException ( "the compulsory Setting named \"" + name + "\" is missing", element );
+		}
+
+		from_setting ( instance, to_child_setting ( element, name ) );
+		return true;
+	}
+
+	//! The existing instance of type T is initialized with values stored in the Setting element[index]
+	//! If there is not any sub-element indexed by #index, this method returns false.
+	template<class T> static bool get ( T &instance, const Setting &element, const int index, SettingPresence settingPresence = optional ) {
+		if ( element.getLength() <= index )
+		{
+			if( settingPresence == optional )
+				return false;
+			else
+			{
+				stringstream stream;
+				stream << index;
+				throw UIException ( "the compulsory Setting with the index " + stream.str()+ " is missing", element );
+			}
+		}
+
+		from_setting ( instance, to_child_setting ( element, index ) );
+		return true;
 	}
 
 	//! The existing instance of type T is initialized with values stored in the Setting element directly
-	template<class T> static void get( T &instance, const Setting &element  )
-	{
-		from_setting( instance, element );
+	template<class T> static bool get ( T &instance, const Setting &element ) {
+		from_setting ( instance, element );
+		return true;
 	}
 	//!@}
@@ -380,23 +429,31 @@
 
 	//! The existing array of type T is initialized with values stored in the Setting element[name]
-	template<class T> static void get( Array<T> &array_to_load, const Setting &element, const string &name )
-	{
-		from_setting( array_to_load, to_child_setting( element, name ) );
+	//! If there is not any sub-element named #name, this method returns false.
+	template<class T> static bool get ( Array<T> &array_to_load, const Setting &element, const string &name, SettingPresence settingPresence = optional ) {
+		if ( !element.exists ( name ) )
+			return false;
+
+		from_setting ( array_to_load, to_child_setting ( element, name ) );
+		return true;
 	}
 
 	//! The existing array of type T is initialized with values stored in the Setting element[index]
-	template<class T> static void get( Array<T> &array_to_load, const Setting &element, const int index )
-	{
-		from_setting( array_to_load, to_child_setting( element, index ) );
+	//! If there is not any sub-element indexed by #index, this method returns false.
+	template<class T> static bool get ( Array<T> &array_to_load, const Setting &element, const int index, SettingPresence settingPresence = optional ) {
+		if ( element.getLength() <= index )
+			return false;
+
+		from_setting ( array_to_load, to_child_setting ( element, index ) );
+		return true;
 	}
 
 	//! The existing array of type T is initialized with values stored in the Setting element
-	template<class T> static void get( Array<T> &array_to_load, const Setting &element  )
-	{
-		from_setting( array_to_load, element );
+	template<class T> static bool get ( Array<T> &array_to_load, const Setting &element ) {
+		from_setting ( array_to_load, element );
+		return true;
 	}
 	//!@}
 
-	//! \name Serialization of objects and structures into a new Setting 
+	//! \name Serialization of objects and structures into a new Setting
 	//!@{
 	//! The new child Setting can be accessed either by its name - if some name is passed as a parameter -
@@ -404,52 +461,54 @@
 
 	//! A root descendant instance is stored in the new child Setting appended to the passed element
-	template< class T> static void save( const T * const instance, Setting &element, const string &name = "")
-	{
-		Setting &set = (name == "") ? element.add( Setting::TypeGroup )							
-									 : element.add( name, Setting::TypeGroup );		
-
-		const string &class_name = MappedUI::retrieve_class_name( &typeid(*instance) );
-			
-		// add attribute "class" 
-		Setting &type = set.add( "class", Setting::TypeString );
+	template< class T> static void save ( const T * const instance, Setting &element, const string &name = "" ) {
+		Setting &set = ( name == "" ) ? element.add ( Setting::TypeGroup )
+		               : element.add ( name, Setting::TypeGroup );
+
+		const string &class_name = MappedUI::retrieve_class_name ( &typeid ( *instance ) );
+
+		// add attribute "class"
+		Setting &type = set.add ( "class", Setting::TypeString );
 		type = class_name;
 
-		try
-		{
-			instance->to_setting( set );
+		try {
+			instance->to_setting ( set );
+		} catch ( SettingException sttng_xcptn ) {
+			string msg = "the method " + class_name + ".to_setting(Setting&) has thrown a SettingException. Try to correct this method. Check path \"" + sttng_xcptn.getPath() + "\".";
+			throw exception ( msg.c_str() );
+		} catch ( UIException uixcptn ) {
+			string msg = "the method " + class_name + ".to_setting(Setting&) has thrown an UIException \"" + uixcptn.message + "\" Try to correct this method. Check path \"" + uixcptn.path + "\".";
+			throw exception ( msg.c_str() );
+		} catch ( exception xcptn ) {
+			string msg = "the method " + class_name + ".to_setting(Setting&) has thrown a general exception \"" + xcptn.what() + "\" Try to correct this method. Check path \"" + element.getPath() + "\".";
+			throw exception ( msg.c_str() );
 		}
-		catch(SettingException xcptn)
-		{
-			throw UIException( "the method " + class_name + ".to_setting(Setting&) has thrown an SettingException. Try to correct this method", xcptn.getPath());
-		}	
 	}
 
 	//! An Array<T> instance is stored in the new child Setting appended to the passed element
-	template<class T> static void save( const Array<T> &array_to_save, Setting &element, const string &name = "" )
-	{
-		assert_type(element,Setting::TypeGroup);
-		Setting &list = (name == "") ? element.add( Setting::TypeList )							
-									 : element.add( name, Setting::TypeList );		
-		for( int i=0; i<array_to_save.length(); i++ ) 
-			save( array_to_save(i), list );
+	template<class T> static void save ( const Array<T> &array_to_save, Setting &element, const string &name = "" ) {
+		assert_type ( element, Setting::TypeGroup );
+		Setting &list = ( name == "" ) ? element.add ( Setting::TypeList )
+		                : element.add ( name, Setting::TypeList );
+		for ( int i = 0; i < array_to_save.length(); i++ )
+			save ( array_to_save ( i ), list );
 	}
 
 	//! A matrix(of type mat) is stored in the new child Setting appended to the passed element
-	static void save( const mat &matrix, Setting &element, const string &name = "" );
+	static void save ( const mat &matrix, Setting &element, const string &name = "" );
 
 	//! An integer vector (of type ivec) is stored in the new child Setting appended to the passed element
-	static void save( const ivec &vec, Setting &element, const string &name = "" );
-	
+	static void save ( const ivec &vec, Setting &element, const string &name = "" );
+
 	//! A double vector (of type vec) is stored in the new child Setting appended to the passed element
-	static void save( const vec &vector, Setting &element, const string &name = "" );
+	static void save ( const vec &vector, Setting &element, const string &name = "" );
 
 	//! A string is stored in the new child Setting appended to the passed element
-	static void save( const string &str, Setting &element, const string &name = "" );
+	static void save ( const string &str, Setting &element, const string &name = "" );
 
 	//! An integer is stored in the new child Setting appended to the passed element
-	static void save( const int &integer, Setting &element, const string &name = "" );
+	static void save ( const int &integer, Setting &element, const string &name = "" );
 
 	//! A double is stored in the new child Setting appended to the passed element
-	static void save( const double &real, Setting &element, const string &name = "" );	
+	static void save ( const double &real, Setting &element, const string &name = "" );
 	//!@}
 
@@ -458,18 +517,16 @@
 
 //! The only UI descendant class which is not intended for direct use. It should be accessed within the ::UIREGISTER macro only.
-template<typename T> class ParticularUI : private UI
-{
+//! \ref ui_page
+template<typename T> class ParticularUI : private UI {
 private:
 	//! Default constructor, which is intentionally declared as private
-	ParticularUI<T>( const string &class_name) : UI( class_name, &typeid(T) ) 
-	{};
+	ParticularUI<T> ( const string &class_name ) : UI ( class_name, &typeid ( T ) ) {};
 
 public:
 	//! The only instance of this class (each type T has its own instance) which is used as a factory for processing related UI
-	static const ParticularUI<T>& factory;	
+	static const ParticularUI<T>& factory;
 
 	//! A method returning a brand new instance of class T, this method is the reason why there have to be a parameterless construcotor in class T
-	root* new_instance() const
-	{
+	root* new_instance() const {
 		return new T();
 	}
@@ -478,3 +535,18 @@
 }
 
+/*!
+  \def UIREGISTER(class_name)
+  \brief Macro for registration of class into map of user-infos, registered class is scriptable using UI static methods
+
+  Argument \a class_name has to be a descendant of root class and also, it has to have parameterless constructor prepared.
+  This macro should be used in header file, immediately after a class declaration.
+
+  \ref ui_page
+*/
+#ifndef BDMLIB
+#define UIREGISTER(class_name) template<> const ParticularUI<class_name>& ParticularUI<class_name>::factory = ParticularUI<class_name>(#class_name)
+#else
+#define UIREGISTER(class_name)
+#endif
+
 #endif // #ifndef USER_INFO_H
Index: /library/bdm/base/bdmbase.h
===================================================================
--- /library/bdm/base/bdmbase.h (revision 462)
+++ /library/bdm/base/bdmbase.h (revision 471)
@@ -330,6 +330,6 @@
   //!@}
   void from_setting(const Setting &set){
-	  if (set.exists("rv")){
-		  RV* r = UI::build<RV>(set,"rv");
+	  RV* r = UI::build<RV>(set,"rv");
+	  if (r){
 		  set_rv(*r); 
 		  delete r;
Index: /library/bdm/base/loggers.cpp
===================================================================
--- /library/bdm/base/loggers.cpp (revision 384)
+++ /library/bdm/base/loggers.cpp (revision 471)
@@ -33,14 +33,4 @@
 	maxlen = set["maxlen"];
 }
-
-/*void memlog::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
 
 void dirfilelog::init() {
@@ -167,15 +157,3 @@
 }
 
-/*void dirfilelog::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-
-
 }
Index: /library/bdm/base/user_info.cpp
===================================================================
--- /library/bdm/base/user_info.cpp (revision 451)
+++ /library/bdm/base/user_info.cpp (revision 471)
@@ -176,7 +176,4 @@
         throw UIException( "only TypeList elements could be indexed by integers", element );
 
-    if ( element.getLength() <= index )
-        throw UIException( "there is not any child with index " + index, element );
-
     return element[index];
 }
@@ -186,7 +183,4 @@
     if ( !element.isGroup())
         throw UIException( "only TypeGroup elements could be indexed by strings", element );
-
-    if ( !element.exists( name ) )
-        throw UIException( "there is not any child named """ + name, element );
 
     return element[name];
Index: /library/bdm/base/bdmbase.cpp
===================================================================
--- /library/bdm/base/bdmbase.cpp (revision 462)
+++ /library/bdm/base/bdmbase.cpp (revision 471)
@@ -173,15 +173,15 @@
 }
 
-void mpdf::from_setting(const Setting &set){
-    if (set.exists("rv")) {
-        RV *r = UI::build<RV>(set, "rv");
-	set_rv(*r);
-	delete r;
+void mpdf::from_setting(const Setting &set){        
+	RV *r = UI::build<RV>(set, "rv");
+    if (r) {
+		set_rv(*r);
+		delete r;
     }
 
-    if (set.exists("rvc")) {
-        RV *r = UI::build<RV>(set, "rvc");
-	set_rvc(*r); 
-	delete r;
+	r = UI::build<RV>(set, "rvc");
+    if (r) {
+		set_rvc(*r); 
+		delete r;
     }
 }
@@ -281,19 +281,13 @@
 {	
 	Array<string> A;
-	if( set.exists("names"))
-		UI::get( A, set, "names" );
-	else
+	if( !UI::get( A, set, "names" ) )
 		A.set_length(0);
 	
 	ivec szs;
-	if( set.exists("sizes"))
-		UI::get(szs,set,"sizes");
-	else
+	if( !UI::get(szs,set,"sizes") )
 		szs = ones_i(A.length());
 	
 	ivec tms;
-	if( set.exists( "times") )
-		UI::get(tms,set,"times");
-	else
+	if( !UI::get(tms,set,"times") )
 		tms = zeros_i(A.length());
 	
@@ -302,14 +296,4 @@
 }
 
-/*void RV::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
 RV concat ( const RV &rv1, const RV &rv2 ) {
 	RV pom = rv1;
@@ -322,5 +306,5 @@
 
 void mepdf::from_setting(const Setting &set) {
-    shared_ptr<epdf> e(UI::build<epdf>(set, "epdf"));
+	shared_ptr<epdf> e(UI::build<epdf>(set, "epdf", UI::compulsory));
     set_ep(e);
 }
Index: /library/bdm/base/datasources.cpp
===================================================================
--- /library/bdm/base/datasources.cpp (revision 384)
+++ /library/bdm/base/datasources.cpp (revision 471)
@@ -56,19 +56,17 @@
 void ArxDS::from_setting( const Setting &set ) 
 {	
-	RV *yrv = UI::build<RV>( set, "y" );
-	RV *urv = UI::build<RV>( set, "u" );
-	RV *rrv = UI::build<RV>( set, "rgr" ); 
+	RV *yrv = UI::build<RV>( set, "y" , UI::compulsory);
+	RV *urv = UI::build<RV>( set, "u" , UI::compulsory);
+	RV *rrv = UI::build<RV>( set, "rgr" , UI::compulsory); 
 				
 	mat Th;
-	UI::get( Th, set, "theta" );
+	UI::get( Th, set, "theta", UI::compulsory );
 
 	vec mu0;
-	if( set.exists( "offset" ))
-		UI::get( mu0, set, "offset" );
-	else
+	if( !UI::get( mu0, set, "offset" ) )
 		mu0= zeros( yrv->_dsize() );
 
 	mat sqR;
-	UI::get( sqR, set, "r" );
+	UI::get( sqR, set, "r", UI::compulsory );
 	set_parameters(Th,mu0,sqR);
 	set_drv(*yrv,*urv,*rrv);
@@ -77,15 +75,4 @@
 		set_options(set["opt"]);
 }
-
-/*void ArxDS::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
 
 CsvFileDS::CsvFileDS ( const string& fname, const string& orientation ) :FileDS() {
@@ -125,5 +112,5 @@
 void ITppFileDS::from_setting( const Setting &set ) 
 {	
-	RV* rvtmp = UI::build<RV>(set, "rv" );
+	RV* rvtmp = UI::build<RV>(set, "rv" , UI::compulsory);
 
 	it_file it ( set["filename"] );
@@ -136,18 +123,8 @@
 }
 
-/*void ITppFileDS::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
 void stateDS::from_setting( const Setting &set ) 
 {	
-	IM = UI::build<mpdf>(set, "IM");
-	OM = UI::build<mpdf>(set, "OM");
+	IM = UI::build<mpdf>(set, "IM", UI::compulsory);			
+	OM = UI::build<mpdf>(set, "OM", UI::compulsory);
 
 	dt.set_length( OM->dimension() );
@@ -155,17 +132,5 @@
 	ut.set_length(0);
 	
-	RV* rvtmp = UI::build<RV>(set["IM"], "rvu");			
+	RV* rvtmp = UI::build<RV>(set["IM"], "rvu", UI::compulsory);			
 	//set_drv(rvtmp);
 }
-
-/*void stateDS::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-
Index: /library/bdm/stat/exp_family.h
===================================================================
--- /library/bdm/stat/exp_family.h (revision 461)
+++ /library/bdm/stat/exp_family.h (revision 471)
@@ -235,10 +235,12 @@
 			const double& _nu() const {return nu;}
 			void from_setting(const Setting &set){
+				UI::get(nu,set,"nu");
+				UI::get(dimx,set,"dimx");
 				set.lookupValue("nu",nu);
 				set.lookupValue("dimx",dimx);
 				mat V;
-				UI::get(V,set,"V");
+				UI::get(V,set,"V", UI::compulsory);
 				set_parameters(dimx, V, nu);
-				RV* rv=UI::build<RV>(set,"rv");
+				RV* rv=UI::build<RV>(set,"rv", UI::compulsory);
 				set_rv(*rv);
 				delete rv;
@@ -402,6 +404,6 @@
 			void from_setting(const Setting &set){
 				epdf::from_setting(set); // reads rv
-				UI::get(alpha,set,"alpha");
-				UI::get(beta,set,"beta");
+				UI::get(alpha,set,"alpha", UI::compulsory);
+				UI::get(beta,set,"beta", UI::compulsory);
 				validate();
 			}
@@ -515,6 +517,7 @@
 			void from_setting(const Setting &set){
 				epdf::from_setting(set); // reads rv and rvc
-				UI::get(high,set,"high");
-				UI::get(low,set,"low");
+
+				UI::get(high,set,"high", UI::compulsory);
+				UI::get(low,set,"low", UI::compulsory);
 			}
 	};
@@ -561,9 +564,10 @@
 			
 			void from_setting(const Setting &set){
-				mpdf::from_setting(set);
-				UI::get(A,set,"A");
-				UI::get(mu_const,set,"const");
+				mpdf::from_setting(set);	
+
+				UI::get(A,set,"A", UI::compulsory);
+				UI::get(mu_const,set,"const", UI::compulsory);
 				mat R0;
-				UI::get(R0,set,"R");
+				UI::get(R0,set,"R", UI::compulsory);
 				set_parameters(A,mu_const,R0);
 			};
@@ -619,29 +623,15 @@
 			void from_setting( const Setting &set ) 
 			{	
-				fnc* g = UI::build<fnc>( set, "g" );
-
-				mat R;
-				if ( set.exists( "dR" ) )
-				{
-					vec dR;
-					UI::get( dR, set, "dR" );
+				fnc* g = UI::build<fnc>( set, "g", UI::compulsory );
+
+				mat R;					
+				vec dR;					
+				if ( UI::get( dR, set, "dR" ) )
 					R=diag(dR);
-				}
 				else 
-					UI::get( R, set, "R");					
+					UI::get( R, set, "R", UI::compulsory); 
 		
 				set_parameters(g,R);
 			}
-
-			/*void mgnorm::to_setting( Setting &set ) const
-			{	
-				Transport::to_setting( set );
-
-				Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-				kilometers_setting = kilometers;
-
-				UI::save( passengers, set, "passengers" );
-			}*/
-
 	};
 
@@ -738,6 +728,6 @@
 				mpdf::from_setting(set); // reads rv and rvc
 				vec betatmp; // ugly but necessary
-				UI::get(betatmp,set,"beta");
-				set.lookupValue("k",k);
+				UI::get(betatmp,set,"beta", UI::compulsory);
+				UI::get(k,set,"k", UI::compulsory);
 				set_parameters(k,betatmp);
 			}
@@ -1214,7 +1204,7 @@
 		epdf::from_setting(set); //reads rv
 		
-		UI::get(mu,set,"mu");
+		UI::get(mu,set,"mu", UI::compulsory);
 		mat Rtmp;// necessary for conversion
-		UI::get(Rtmp,set,"R");
+		UI::get(Rtmp,set,"R", UI::compulsory);
 		R=Rtmp; // conversion
 		validate();
Index: /library/bdm/stat/merger.h
===================================================================
--- /library/bdm/stat/merger.h (revision 423)
+++ /library/bdm/stat/merger.h (revision 471)
@@ -275,5 +275,5 @@
 			// find which method to use
 			string meth_str;
-			UI::get<string> (meth_str, set, "method");
+			UI::get<string> (meth_str, set, "method", UI::compulsory);
 			if (!strcmp (meth_str.c_str(), "arithmetic"))
 				set_method (ARITHMETIC);
@@ -286,9 +286,7 @@
 				}
 			}
-			if (set.exists("dbg_file")){ 
-				string dbg_file;
-				UI::get<string> (dbg_file, set, "dbg_file");
+			string dbg_file;
+			if (UI::get(dbg_file, set, "dbg_file"))
 				set_debug_file(dbg_file);
-			}
 			//validate() - not used
 		}
Index: /library/bdm/stat/emix.h
===================================================================
--- /library/bdm/stat/emix.h (revision 461)
+++ /library/bdm/stat/emix.h (revision 471)
@@ -329,5 +329,5 @@
 	void from_setting(const Setting &set){
 		Array<mpdf*> Atmp; //temporary Array
-		UI::get(Atmp,set, "mpdfs");
+		UI::get(Atmp,set, "mpdfs", UI::compulsory);
 		set_elements(Atmp,true);
 	}
Index: /library/bdm/stat/exp_family.cpp
===================================================================
--- /library/bdm/stat/exp_family.cpp (revision 461)
+++ /library/bdm/stat/exp_family.cpp (revision 471)
@@ -325,37 +325,15 @@
 {				
 	vec ref;
-	UI::get( ref, set, "ref" );
+	UI::get( ref, set, "ref" , UI::compulsory);
 	set_parameters(set["k"],ref,set["l"]);
 }
-
-/*void migamma_ref::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
 
 void mlognorm::from_setting( const Setting &set ) 
 {	
-	vec mu0;
-	UI::get( mu0, set, "mu0");
+	vec mu0;	
+	UI::get( mu0, set, "mu0", UI::compulsory);
 	set_parameters(mu0.length(),set["k"]);
 	condition(mu0);
 }
 
-/*void mlognorm::to_setting( Setting &set ) const
-{	
-	Transport::to_setting( set );
-
-	Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt );
-	kilometers_setting = kilometers;
-
-	UI::save( passengers, set, "passengers" );
-}*/
-
-
 };
Index: /library/tests/test_user_info.cpp
===================================================================
--- /library/tests/test_user_info.cpp (revision 425)
+++ /library/tests/test_user_info.cpp (revision 471)
@@ -9,228 +9,217 @@
 using namespace bdm;
 
-class Passenger : public root
-{
-public:
-
-  Passenger() {
-  }
-};
-
-class Human : public Passenger
-{
-public:
-  string name;
-
-  Human() {
-    name = "none";
-  }
-
-  virtual void from_setting(const Setting &set) {
-    set.lookupValue("name", name);
-  }
-
-  virtual void to_setting(Setting &set) const {
-    Setting &name_setting = set.add("name", Setting::TypeString);
-    name_setting = name;
-  }
-
-  string to_string() {
-    return name;
-  }
-};
-
-UIREGISTER(Human);
-
-class Robot : public Passenger
-{
-public:
-  int number;
-  Array<string> software;
-
-  Robot() : software() {
-    number = -1;
-  }
-
-  virtual void from_setting(const Setting &set) {
-    set.lookupValue("number", number);
-	if( set.exists( "software" ) )
-		UI::get(software, set, "software");
-  }
-
-  virtual void to_setting(Setting &set) const {
-    Setting &number_setting = set.add("number", Setting::TypeInt);
-    number_setting = number;
-
-    UI::save(software, set, "software");
-  }
-
-  string to_string() {
-    stringstream stream;
-    stream << number;
-    for (int i = 0; i < software.length(); i++)
-      stream << "_" + software(i);
-    return stream.str();
-  }
-};
-
-UIREGISTER(Robot);
-
-class Transport : public root
-{
-public:
-  int year;
-  string manufacturer;
-
-  Transport() {
-    year = 1900;
-    manufacturer = "unknown";
-  }
-
-  Transport(int year, string manufacturer)
-      : year(year), manufacturer(manufacturer) {
-  }
-
-  virtual void from_setting(const Setting &set) {
-    set.lookupValue("year", year);
-    set.lookupValue("manufacturer", manufacturer);
-  }
-
-  virtual void to_setting(Setting &set) const {
-    Setting &year_setting = set.add("year", Setting::TypeInt);
-    year_setting = year;
-
-    Setting &manufacturer_setting = set.add("manufacturer", Setting::TypeString);
-    manufacturer_setting = manufacturer;
-  }
-};
-
-class Car : public Transport
-{
-public:
-  int kilometers;
-  Array<Passenger*> passengers;
-
-  Car() : Transport() {
-    kilometers = 0;
-  }
-
-
-  Car(int year, string manufacturer, int kilometers)
-      : Transport(year, manufacturer), kilometers(kilometers) {
-  }
-
-  virtual void from_setting(const Setting &set) {
-    Transport::from_setting(set);
-
-    set.lookupValue("kilometers", kilometers);
-
-	if( set.exists( "passengers" ) )
-	    UI::get(passengers, set, "passengers");
-  }
-
-  virtual void to_setting(Setting &set) const {
-    Transport::to_setting(set);
-
-    Setting &kilometers_setting = set.add("kilometers", Setting::TypeInt);
-    kilometers_setting = kilometers;
-
-    UI::save(passengers, set, "passengers");
-  }
-
-  string to_string() {
-    stringstream stream;
-    stream << "A car made in " << year << " by " << manufacturer << ", having " << kilometers << " kilometers on the clock.";
-    if (passengers.length()) {
-      stream << "The names of passengers are as follows: ";
-      for (int i = 0; i < passengers.length(); i++)
-        stream << passengers(i)->to_string() << " ";
-    }
-    return stream.str();
-  }
-};
-
-UIREGISTER(Car);
-
-class Bike : public Transport
-{
-public:
-  bool electricLights;
-  mat matr;
-
-  Bike() : Transport(), matr("2,2;3,4") {
-    electricLights = false;
-  }
-
-  Bike(int year, string manufacturer, bool electricLights)
-      : Transport(year, manufacturer), electricLights(electricLights) {
-  }
-
-  ~Bike() {
-  }
-
-  void from_setting(const Setting &set) {
-    Transport::from_setting(set);
-
-    set.lookupValue("electricLights", electricLights);
-
-	UI::get(matr, set, "matr");
-  }
-
-  void to_setting(Setting &set) const {
-    Transport::to_setting(set);
-
-    Setting &electricLights_setting = set.add("electricLights", Setting::TypeBoolean);
-    electricLights_setting = electricLights;
-
-    UI::save(matr, set, "matr");
-  }
-
-  string to_string() {
-    stringstream stream;
-    stream << "a bike made in " << year << " by " << manufacturer;
-    if (electricLights) stream << " with electric lights included";
-    return stream.str();
-  }
-};
-
-UIREGISTER(Bike);
-
-TEST(test_load)
-{
-  UIFile in("test_user_info_input.cfg");
-  auto_ptr<Transport> pepikovo(UI::build<Transport>(in, "pepikovo"));
-  CHECK_EQUAL(string("A car made in 1998 by audi, having 25000 kilometers on the clock.The names of passengers are as follows: Karlos Novak -1_CygWin_Matlab_Aimsun Karlosik Novacek "), pepikovo->to_string());
-
-  auto_ptr<Transport> jardovo(UI::build<Transport>(in, "jardovo"));
-  CHECK_EQUAL(string("A car made in 1992 by liaz, having 1555000 kilometers on the clock."), jardovo->to_string());
-
-  auto_ptr<Transport> ondrejovo(UI::build<Transport>(in, "ondrejovo"));
-  CHECK_EQUAL(string("a bike made in 1996 by author with electric lights included"), ondrejovo->to_string());
-
-  auto_ptr<Transport> elisky(UI::build<Transport>(in, "elisky"));
-  CHECK_EQUAL(string("A car made in 1992 by liaz, having 1555000 kilometers on the clock."), elisky->to_string());
-
-  auto_ptr<Transport> kati(UI::build<Transport>(in, "kati"));
-  CHECK_EQUAL(string("A car made in 1980 by vecernicek, having 250000 kilometers on the clock."), kati->to_string());
+class Passenger : public root {
+public:
+
+	Passenger() {
+	}
+};
+
+class Human : public Passenger {
+public:
+	string name;
+
+	Human() {
+		name = "none";
+	}
+
+	virtual void from_setting ( const Setting &set ) {
+		UI::get ( name, set, "name" );
+	}
+
+	virtual void to_setting ( Setting &set ) const {
+		Setting &name_setting = set.add ( "name", Setting::TypeString );
+		name_setting = name;
+	}
+
+	string to_string() {
+		return name;
+	}
+};
+
+UIREGISTER ( Human );
+
+class Robot : public Passenger {
+public:
+	int number;
+	Array<string> software;
+
+	Robot() : software() {
+		number = -1;
+	}
+
+	virtual void from_setting ( const Setting &set ) {
+		UI::get ( number, set, "number" );
+		UI::get ( software, set, "software" );
+	}
+
+	virtual void to_setting ( Setting &set ) const {
+		Setting &number_setting = set.add ( "number", Setting::TypeInt );
+		number_setting = number;
+
+		UI::save ( software, set, "software" );
+	}
+
+	string to_string() {
+		stringstream stream;
+		stream << number;
+		for ( int i = 0; i < software.length(); i++ )
+			stream << "_" + software ( i );
+		return stream.str();
+	}
+};
+
+UIREGISTER ( Robot );
+
+class Transport : public root {
+public:
+	int year;
+	string manufacturer;
+
+	Transport() {
+		year = 1900;
+		manufacturer = "unknown";
+	}
+
+	Transport ( int year, string manufacturer )
+			: year ( year ), manufacturer ( manufacturer ) {
+	}
+
+	virtual void from_setting ( const Setting &set ) {
+		UI::get ( year, set, "year" );
+		UI::get ( manufacturer, set, "manufacturer" );
+	}
+
+	virtual void to_setting ( Setting &set ) const {
+		Setting &year_setting = set.add ( "year", Setting::TypeInt );
+		year_setting = year;
+
+		Setting &manufacturer_setting = set.add ( "manufacturer", Setting::TypeString );
+		manufacturer_setting = manufacturer;
+	}
+};
+
+class Car : public Transport {
+public:
+	int kilometers;
+	Array<Passenger*> passengers;
+
+	Car() : Transport() {
+		kilometers = 0;
+	}
+
+
+	Car ( int year, string manufacturer, int kilometers )
+			: Transport ( year, manufacturer ), kilometers ( kilometers ) {
+	}
+
+	virtual void from_setting ( const Setting &set ) {
+		Transport::from_setting ( set );
+
+		UI::get ( kilometers, set, "kilometers" );
+		UI::get ( passengers, set, "passengers" );
+	}
+
+	virtual void to_setting ( Setting &set ) const {
+		Transport::to_setting ( set );
+
+		Setting &kilometers_setting = set.add ( "kilometers", Setting::TypeInt );
+		kilometers_setting = kilometers;
+
+		UI::save ( passengers, set, "passengers" );
+	}
+
+	string to_string() {
+		stringstream stream;
+		stream << "A car made in " << year << " by " << manufacturer << ", having " << kilometers << " kilometers on the clock.";
+		if ( passengers.length() ) {
+			stream << "The names of passengers are as follows: ";
+			for ( int i = 0; i < passengers.length(); i++ )
+				stream << passengers ( i )->to_string() << " ";
+		}
+		return stream.str();
+	}
+};
+
+UIREGISTER ( Car );
+
+class Bike : public Transport {
+public:
+	bool electricLights;
+	mat matr;
+
+	Bike() : Transport(), matr ( "2,2;3,4" ) {
+		electricLights = false;
+	}
+
+	Bike ( int year, string manufacturer, bool electricLights )
+			: Transport ( year, manufacturer ), electricLights ( electricLights ) {
+	}
+
+	~Bike() {
+	}
+
+	void from_setting ( const Setting &set ) {
+		Transport::from_setting ( set );
+
+		UI::get ( electricLights, set, "electricLights" );
+
+		UI::get ( matr, set, "matr" );
+	}
+
+	void to_setting ( Setting &set ) const {
+		Transport::to_setting ( set );
+
+		Setting &electricLights_setting = set.add ( "electricLights", Setting::TypeBoolean );
+		electricLights_setting = electricLights;
+
+		UI::save ( matr, set, "matr" );
+	}
+
+	string to_string() {
+		stringstream stream;
+		stream << "a bike made in " << year << " by " << manufacturer;
+		if ( electricLights ) stream << " with electric lights included";
+		return stream.str();
+	}
+};
+
+UIREGISTER ( Bike );
+
+TEST ( test_load ) {
+	UIFile in ( "test_user_info_input.cfg" );
+	auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo" ) );
+	CHECK_EQUAL ( string ( "A car made in 1998 by audi, having 25000 kilometers on the clock.The names of passengers are as follows: Karlos Novak -1_CygWin_Matlab_Aimsun Karlosik Novacek " ), pepikovo->to_string() );
+
+	auto_ptr<Transport> jardovo ( UI::build<Transport> ( in, "jardovo" ) );
+	CHECK_EQUAL ( string ( "A car made in 1992 by liaz, having 1555000 kilometers on the clock." ), jardovo->to_string() );
+
+	auto_ptr<Transport> ondrejovo ( UI::build<Transport> ( in, "ondrejovo" ) );
+	CHECK_EQUAL ( string ( "a bike made in 1996 by author with electric lights included" ), ondrejovo->to_string() );
+
+	auto_ptr<Transport> elisky ( UI::build<Transport> ( in, "elisky" ) );
+	CHECK_EQUAL ( string ( "A car made in 1992 by liaz, having 1555000 kilometers on the clock." ), elisky->to_string() );
+
+	auto_ptr<Transport> kati ( UI::build<Transport> ( in, "kati" ) );
+	CHECK_EQUAL ( string ( "A car made in 1980 by vecernicek, having 250000 kilometers on the clock." ), kati->to_string() );
 }
 
-TEST(test_save)
-{
-  UIFile in("test_user_info_input.cfg");
-  auto_ptr<Transport> pepikovo(UI::build<Transport>(in, "pepikovo"));
-
-  Car audi(1968, "zyl", 200);
-  Car liaz(1989, "skoda", 1000);
-  Bike author(2001, "noname", false);
-  UIFile out;
-
-  UI::save(&audi, out, "marty");
-  UI::save(&liaz, out, "bohousovo");
-  UI::save(&author, out, "karlovo");
-  UI::save(pepikovo.get(), out, "pepikovo");
-  out.save("testUI_out.cfg");
-
-  string expected(load_test_file("testUI_out.matrix"));
-  string actual(load_test_file("testUI_out.cfg"));
-  CHECK_EQUAL(expected, actual);
+TEST ( test_save ) {
+	UIFile in ( "test_user_info_input.cfg" );
+	auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo" ) );
+
+	Car audi ( 1968, "zyl", 200 );
+	Car liaz ( 1989, "skoda", 1000 );
+	Bike author ( 2001, "noname", false );
+	UIFile out;
+
+	UI::save ( &audi, out, "marty" );
+	UI::save ( &liaz, out, "bohousovo" );
+	UI::save ( &author, out, "karlovo" );
+	UI::save ( pepikovo.get(), out, "pepikovo" );
+	out.save ( "testUI_out.cfg" );
+
+	string expected ( load_test_file ( "testUI_out.matrix" ) );
+	string actual ( load_test_file ( "testUI_out.cfg" ) );
+	CHECK_EQUAL ( expected, actual );
 }
Index: /library/tests/egiw_harness.cpp
===================================================================
--- /library/tests/egiw_harness.cpp (revision 456)
+++ /library/tests/egiw_harness.cpp (revision 471)
@@ -8,6 +8,6 @@
 
 void egiw_harness::from_setting(const Setting &set) {
-    epdf_harness::from_setting(set);
-    UI::get(lognc, set, "lognc");
+    epdf_harness::from_setting(set);				
+    UI::get(lognc, set, "lognc", UI::compulsory);
 }
 
Index: /library/tests/epdf_harness.cpp
===================================================================
--- /library/tests/epdf_harness.cpp (revision 469)
+++ /library/tests/epdf_harness.cpp (revision 471)
@@ -29,31 +29,19 @@
 
 void epdf_harness::from_setting(const Setting &set) {
-    hepdf = UI::build<epdf>(set, "epdf");
-    UI::get(mean, set, "mean");
-    UI::get(variance, set, "variance");
+    hepdf = UI::build<epdf>(set, "epdf", UI::compulsory);
+    UI::get(mean, set, "mean", UI::compulsory);
+    UI::get(variance, set, "variance", UI::compulsory);
 
-    if (set.exists("support")) {
-        UI::get(support, set, "support");
-    }
 
-    if (set.exists("nbins")) {
-        UI::get(nbins, set, "nbins");
-    }
+	UI::get(support, set, "support");
+	UI::get(nbins, set, "nbins");
+    UI::get(nsamples, set, "nsamples");
+    UI::get(R, set, "R");
 
-    if (set.exists("nsamples")) {
-        UI::get(nsamples, set, "nsamples");
-    }
+	RV* rv = UI::build<RV>(set, "marginal_rv");
+    if (rv) 
+        mrv = shared_ptr<RV>(rv);    
 
-    if (set.exists("R")) {
-        UI::get(R, set, "R");
-    }
-
-    if (set.exists("marginal_rv")) {
-        mrv = shared_ptr<RV>(UI::build<RV>(set, "marginal_rv"));
-    }
-
-    if (set.exists("tolerance")) {
-        UI::get(tolerance, set, "tolerance");
-    }
+	UI::get(tolerance, set, "tolerance");    
 }
 
Index: /library/tests/mpdf_harness.cpp
===================================================================
--- /library/tests/mpdf_harness.cpp (revision 456)
+++ /library/tests/mpdf_harness.cpp (revision 471)
@@ -18,5 +18,5 @@
     UIFile in(config_file_name);
     Array<mpdf_harness *> input;
-    UI::get(input, in, "data");
+	UI::get(input, in, "data");
     int sz = input.size();
     CHECK(sz > 0);
@@ -26,18 +26,13 @@
 }
 
-void mpdf_harness::from_setting(const Setting &set) {
-    hmpdf = UI::build<mpdf>(set, "mpdf");
-    UI::get(cond, set, "cond");
-    UI::get(mean, set, "mean");
+void mpdf_harness::from_setting(const Setting &set) {			
+	hmpdf = UI::build<mpdf>(set, "mpdf", UI::compulsory);
+    UI::get(cond, set, "cond", UI::compulsory);
+    UI::get(mean, set, "mean", UI::compulsory);
 
-    if (set.exists("nsamples")) {
-        UI::get(nsamples, set, "nsamples");
-    }
 
+	UI::get(nsamples, set, "nsamples");
     UI::get(R, set, "R");
-
-    if (set.exists("tolerance")) {
-        UI::get(tolerance, set, "tolerance");
-    }
+	UI::get(tolerance, set, "tolerance");
 }
 
Index: /library/Doxyfile
===================================================================
--- /library/Doxyfile (revision 397)
+++ /library/Doxyfile (revision 471)
@@ -522,5 +522,5 @@
 # by doxygen. Possible values are YES and NO. If left blank NO is used.
 
-QUIET                  = NO
+QUIET                  = YES
 
 # The WARNINGS tag can be used to turn on/off the warning messages that are 
@@ -564,5 +564,5 @@
 # to stderr.
 
-WARN_LOGFILE           = 
+WARN_LOGFILE           = .\doxy_warnings.txt 
 
 #---------------------------------------------------------------------------
Index: /library/system/win32/run_astyler.bat
===================================================================
--- /library/system/win32/run_astyler.bat (revision 471)
+++ /library/system/win32/run_astyler.bat (revision 471)
@@ -0,0 +1,16 @@
+@echo off
+IF "%1"=="" GOTO INFO
+
+.\astyle_1.23_windows\astyle\bin\AStyle.exe --options=..\astylerc %1
+
+GOTO END
+:INFO
+
+@echo ==========================================================================
+@echo   Pass the filename as the first parameter: "run_astyler.bat [filename]"
+@echo ==========================================================================
+
+:END
+pause
+
+
Index: /library/system/astylerc
===================================================================
--- /library/system/astylerc (revision 408)
+++ /library/system/astylerc (revision 471)
@@ -29,3 +29,9 @@
 pad=paren
 unpad=paren
-one-line=keep-blocks
+
+#Don't want to break one-line blocks? Uncomment the following line... 
+#one-line=keep-blocks
+#Code like:
+#   if (isFoo)
+#      { isFoo = false; cout << isFoo << endl; }
+# then remains unchanged.
Index: /library/doc/tutorial/arx_ui.dox
===================================================================
--- /library/doc/tutorial/arx_ui.dox (revision 272)
+++ /library/doc/tutorial/arx_ui.dox (revision 471)
@@ -6,5 +6,5 @@
 \section cmd Command Line
 
-In order to use it for estimation of an ARX model, we can define the following \ref ui structure:
+In order to use it for estimation of an ARX model, we can define the following \ref ui_page structure:
 \include arx_test.cfg
 
Index: /library/doc/tutorial/mexfiles.dox
===================================================================
--- /library/doc/tutorial/mexfiles.dox (revision 272)
+++ /library/doc/tutorial/mexfiles.dox (revision 471)
@@ -5,5 +5,5 @@
 
 A range of mexfiles is predefined in directory \c library/mex.
-Many of these mexfile process ui files (see \ref ui) examples of these files are in directory \c library/tutorial.
+Many of these mexfile process ui files (see \ref ui_page) examples of these files are in directory \c library/tutorial.
 Note that in order to run these files you need to let matlab know where to find them:
 \code
Index: /library/doc/tutorial/manual.dox
===================================================================
--- /library/doc/tutorial/manual.dox (revision 272)
+++ /library/doc/tutorial/manual.dox (revision 471)
@@ -13,5 +13,5 @@
 Basic concepts and philosophy of BDM:
 - \subpage intro
-- \subpage ui
+- \subpage ui_page
 - \subpage mexfiles
 
Index: /library/doc/tutorial/ui.dox
===================================================================
--- /library/doc/tutorial/ui.dox (revision 272)
+++ /library/doc/tutorial/ui.dox (revision 471)
@@ -1,15 +1,27 @@
 /*!
-\page ui User Infos and their use 
+\page ui_page User Infos and their use
+ 
+\sa #bdm::UI
 
-For easier interaction with users, experiments can be configured via structures called User Info. These structures contain information about details of the experiment that is to be performed. Since experiments involve the use of basic BDM classes and their compositions, the experiment description is also hierarchical with specific user info for each object or class.
+\sa #UIREGISTER
 
- The User Infos are designed using customized version of the libconfig library (link!). It is specialized for BDM so as to recognize basic mathematical objects, such as vectors and matrices, see ... for details.
+\sa #bdm::UIFile
+
+\sa <a href="http://www.hyperrealm.com/libconfig/">The web page of the libconfig library.</a>
+
+\section ui_intro Introduction
+
+For easier interaction with users, experiments can be configured via structures called <b>User Info</b>. These structures contain information about details of the experiment that is to be performed. Since experiments involve the use of basic BDM classes and their compositions, the experiment description is also hierarchical with specific user info for each object or class.
+
+The User Infos are designed using customized version of the libconfig library (www.hyperrealm.com/libconfig). It is specialized for BDM so as to recognize basic mathematical objects, such as vectors and matrices, see details below.
  
- (Technically it can be made compatible with matlab structures!)
+Technically it can be made compatible with matlab structures (TODO)
+
+\section ui_example Example
  
- For example a simple experiment can be configures in a following way: 
+For example, a simple experiment can be configures in the following way: 
 \code
 ndat = 100;                //number of data points
-prior = {type="enorm";
+prior = { class="enorm";
         mu = [1, 2, 3];
         R = [1, 0, 0,
@@ -18,7 +30,68 @@
 };
 \endcode
- Exact meaning of root fields in this structure (i.e. ndat and prior) 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.
+The exact meaning of the root fields in this structure (i.e. \c ndat and \c prior) 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.
  
- A structure with field \c type="identifier" is special. Such a structure will be parsed by an appropriate class bdm::UIbuilder which will construct the desired object, in this instance of an object of the class bdm::enorm.
- For a detailed example how this mechanism works in practice see \ref arx_ui.
- */
+A structure with field \c class="identifier" is special. Such a structure will be parsed by an appropriate #bdm::UI::build method which will construct the desired object, in this instance of an object of the class bdm::enorm.
+ 
+For a detailed example how this mechanism works in practice see \ref arx_ui. To learn about the possinility of making <b> internal or external links</b> in configuration files, see the documentation of #bdm::SettingResolver.
+
+\section ui_implementation Implementation of user info in a custom class
+ 
+In accordance with the previous example of the configuration file, consider the class defined as follows:
+
+\code
+
+class newbee : public bdm::root {  
+  ...
+    
+  bdm::enorm prior;
+  int ndat;
+  
+  ...   
+}
+
+\endcode
+  
+There are few obligatory steps to implement user info mechanism in this class.  At first, the class has to be \b inherited (directly or indirectly) from #bdm::root, 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. 
+
+Next, <b>two virtual methods</b> #bdm::root::from_setting and #bdm::root::to_setting defined in the #bdm::root class <b>should be overriden </b> in accordance with the content of the current class. In fact, you can override just method #bdm::root::from_setting 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 #bdm::root::to_setting.
+
+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 #bdm::root class). Then, they should contain loading of all the necessary class attributes in the case of #bdm::root::from_setting method and saving of them in the other case. To implement these operation, you are encouraged to use static methods of #bdm::UI class, namely #bdm::UI::get, #bdm::UI::build and #bdm::UI::save. 
+
+It can look like this:
+
+\code 
+ 
+class newbee : public bdm::root {  
+  ...
+    
+  bdm::enorm prior;
+  int ndat;
+  
+  ...
+
+  virtual void from_setting(const Setting &set) {
+    root::from_setting(set);
+    if( !UI::get( ndat, set, "ndat" ) )
+       ndat = 1;	  
+    prior = UI::build<enorm>( set, "prior", compulsory );
+  }
+
+  virtual void to_setting(Setting &set) const {
+    root::to_setting(set);
+    UI::save(ndat, set, "ndat");
+    UI::save(prior, set, "prior");
+  }
+
+  ...
+}
+
+\endcode
+
+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 \c ndat is optional. Thereore, the default value is filled in the case that there is not any other in the configuration file (and so #bdm::UI::get method returs \c false). The second atribute, \c prior, is intended to be compulsory. This fact is specified by the last parameter of the templated #bdm::UI::build method. In this case, the method throws an exception if there is not proper data in the configuration file. 
+
+The only difference between #bdm::UI::build and #bdm::UI::get method is in the types of variables they are prepared to. The #bdm::UI::build<T> method is used to initialize instances of classes derived from #bdm::root. 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 #bdm::UI::get method with a static memory management. It is also capable to load arrays of templated type #itpp::Array<T>. 
+
+Saving is much more easier. For all the variable types, use the #bdm::UI::save method.
+*/
