Index: library/bdm/base/bdmbase.h
===================================================================
--- library/bdm/base/bdmbase.h (revision 907)
+++ library/bdm/base/bdmbase.h (revision 910)
@@ -298,48 +298,15 @@
 
 //! This class stores a details that will be logged to a logger
-template<class T> class log_level_template : public log_level_base {
-	//! this is necessary to allow logger to set ids vector appropriately and also to set registered_logger
-	friend class logger; 
-
-	//! vector of log IDs - one element for each entry
-	ivec ids;
-
-	//! internal pointer to the logger to which this log_level is registered
-	//! 
-	//! it is set to NULL at the beginning
-	logger * registered_logger;
-
-public:
-	//! default constructor
-	log_level_template() {
-		registered_logger = NULL;
-		ids.set_size(  T::log_level_names().length() );
+//!
+//! This is only the first part of the whole declaration, which has to be however separated into
+//! two different classes for allowing the compilation of source code. For more details
+//! see logger::add_setting(...) method and mainly log_level_template<T>::template<class U> void store( const enum T::log_level_enums log_level_enum, const U data ) const
+//! method. For the reason the second one is templated, it was necessary to declare this whole class. 
+template<class T> class log_level_intermediate : public log_level_base {
+public:
+	log_level_intermediate( ) {
+		ids.set_size( names().length() );
 		ids = -1;
 	}
-
-	//! This method stores a vector to the proper place in registered logger 
-	void store( const enum T::log_level_enums log_level_enum, const vec &vect ) const
-	{
-		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! Use root::log_register(...) method.");
-		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular vector was not added to logger! Use logger::add_vector(...) method.");
-		registered_logger->log_vector( ids( log_level_enum ), vect );
-	}
-
-	//! This method stores a double to the proper place in registered logger 
-	void store( const enum T::log_level_enums log_level_enum, const double &dbl ) const
-	{
-		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! See root::log_register(...) method.");
-		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular double was not added to logger! Use logger::add_vector(...) method.");
-		registered_logger->log_double( ids( log_level_enum ), dbl );
-	}
-
-	//! This method stores a Setting obtained by call of UI::save( data, .. ) to the proper place in registered logger 
-	template<class U> void store( const enum T::log_level_enums log_level_enum, const U data ) const
-	{			
-		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! See root::log_register(...) method.");
-		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular vector was not added to logger! Use logger::add_setting(...) method.");
-		registered_logger->log_setting( ids( log_level_enum ), data);
-	}
-
 
 	//! string equivalents of the used enumerations which are filled with a help of #LOG_LEVEL macro within class T
@@ -349,5 +316,5 @@
 	}
 
-	//! read only operator for testing  individual fields of log_level
+	//! read only operator for testing individual fields of log_level
 	//!
 	//! it is necessary to acces it with a proper enumeration type, thus this approach is type-safe
@@ -365,21 +332,4 @@
 	}
 };
-
-/*!
-  \def LOG_LEVEL(classname,...)
-  \brief Macro for defining a log_level attribute with a specific set of enumerations related to a specific class 
-
-  This macro has to be called within a class declaration. Its argument \a classname has to correspond to that wrapping class.
-  This macro defines a log_level instance which can be modified either directly or by the means of #UI class.
-
-  One of the main purposes of this macro is to allow variability in using enumerations. By relating them to their names through
-  an array of strings, we are no more dependant on their precise ordering. What is more, we can add or remove any without harming 
-  any applications which are using this library.
-
-  \todo Write a more detailed explanation including also examples
-
-  \ref ui
-*/
-#define LOG_LEVEL(classname,...) public: enum log_level_enums { __VA_ARGS__ }; log_level_template<classname> log_level; private: friend class log_level_template<classname>; static const Array<string> &log_level_names() { static const Array<string> log_level_names = log_level_base::string2Array( #__VA_ARGS__ ); return log_level_names; }
 
 
@@ -442,5 +392,5 @@
 	//! It also sets a pointer to logger or justify it is correctly assigned from previous call to this procedure 
 	//! Entries with empty RV will be ignored 
-	template<class T> void add_vector ( log_level_template<T> &log_level, enum T::log_level_enums const log_level_enum, const RV &rv, const string &prefix )
+	template<class T> void add_vector ( log_level_intermediate<T> &log_level, enum T::log_level_enums const log_level_enum, const RV &rv, const string &prefix )
 	{
 		if( !log_level.registered_logger )
@@ -448,5 +398,4 @@
 		else
 			bdm_assert_debug ( log_level.registered_logger == this, "This log_level is already registered to another logger!");
-
 
 		if ( rv._dsize() == 0 ) 
@@ -464,5 +413,9 @@
 	//!
 	//! It also sets a pointer to logger or justify it is correctly assigned from previous call to this procedure 
-	template<class T> void add_setting ( log_level_template<T> &log_level, enum T::log_level_enums const log_level_enum,  const string &prefix ) {
+	//!
+	//! To allow both arguments log_level and log_level_enum be templated, it was necessary to declare log_level_intermediate<T> class.
+	//! This way we check compatibility of the passed log_level and log_level_enum, which would be impossible using just log_level_base class
+	//! here. 
+	template<class T> void add_setting ( log_level_intermediate<T> &log_level, enum T::log_level_enums const log_level_enum,  const string &prefix ) {
 		if( !log_level.registered_logger )
 			log_level.registered_logger = this;
@@ -489,4 +442,57 @@
 	virtual void init() {};
 };
+
+//! This class stores a details that will be logged to a logger
+template<class T> class log_level_template : public log_level_intermediate<T> {
+public:
+	//! This method stores a vector to the proper place in registered logger 
+	void store( const enum T::log_level_enums log_level_enum, const vec &vect ) const
+	{
+		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! Use root::log_register(...) method.");
+		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular vector was not added to logger! Use logger::add_vector(...) method.");
+		registered_logger->log_vector( ids( log_level_enum ), vect );
+	}
+
+	//! This method stores a double to the proper place in registered logger 
+	void store( const enum T::log_level_enums log_level_enum, const double &dbl ) const
+	{
+		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! See root::log_register(...) method.");
+		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular double was not added to logger! Use logger::add_vector(...) method.");
+		registered_logger->log_double( ids( log_level_enum ), dbl );
+	}
+
+	//! This method stores a Setting obtained by call of UI::save( data, .. ) to the proper place in registered logger 
+	//!
+	//! If this method was not templated, we could store whole body of this class in cpp file without explicitly touching registered_logger->log_setting(...) here.
+	//! (it would not be straightforward, though, still there are some enums which had to be converted into integers but it could be done without loosing type control)
+	//! This way, it would not be necessary to declare log_level_intermediate<T> class and we could declare log_level_template<T>
+	//! before the log_level class itself with a mere foroward declaration of log_level. In our case, however, touching of registered_logger->log_setting
+	//! implies that friend declaration is not enough and we are lost in a circle. And just by cutting this circle we obtains log_level_intermediate<T> class. 
+	//! Howg.)
+	template<class U> void store( const enum T::log_level_enums log_level_enum, const U data ) const
+	{			
+		bdm_assert_debug( registered_logger != NULL, "You have to register instance to a logger first! See root::log_register(...) method.");
+		bdm_assert_debug( ids( log_level_enum ) >= 0, "This particular vector was not added to logger! Use logger::add_setting(...) method.");
+		registered_logger->log_setting( ids( log_level_enum ), data);
+	}
+};
+
+/*!
+  \def LOG_LEVEL(classname,...)
+  \brief Macro for defining a log_level attribute with a specific set of enumerations related to a specific class 
+
+  This macro has to be called within a class declaration. Its argument \a classname has to correspond to that wrapping class.
+  This macro defines a log_level instance which can be modified either directly or by the means of #UI class.
+
+  One of the main purposes of this macro is to allow variability in using enumerations. By relating them to their names through
+  an array of strings, we are no more dependant on their precise ordering. What is more, we can add or remove any without harming 
+  any applications which are using this library.
+
+  \todo Write a more detailed explanation including also examples
+
+  \ref ui
+*/
+#define LOG_LEVEL(classname,...) public: enum log_level_enums { __VA_ARGS__ }; log_level_template<classname> log_level; private: friend class log_level_template<classname>; friend class log_level_intermediate<classname>; static const Array<string> &log_level_names() { static const Array<string> log_level_names = log_level_base::string2Array( #__VA_ARGS__ ); return log_level_names; }
+
 
 //! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv
