Index: /library/bdm/base/bdmbase.h
===================================================================
--- /library/bdm/base/bdmbase.h (revision 770)
+++ /library/bdm/base/bdmbase.h (revision 788)
@@ -15,4 +15,6 @@
 
 #include <map>
+#include <string>
+#include <bitset>
 
 #include "../itpp_ext.h"
@@ -970,4 +972,62 @@
 */
 
+#ifndef BDMLIB
+// MUZEME INTERNE POUZIVAT ENUMY, A KLIDNE MENIT JEJICH PORADI, DIKY TOMUHLE MAKRU SE VZDY NAMAPUJI NA TY SPRAVNE STRINGY 
+#define DEFINED_OPTIONS(...) enum defined_options { __VA_ARGS__ }; const Array<string> logged_options::names( "{"#__VA_ARGS__"}" )
+// TODO: ROZPARESUJE TO KONSTRUKTOR ARRAYE NA JEDNOTLIVE STRINGY?? NUTNO OTESTOVAT!!
+#else
+#define DEFINED_OPTIONS(...) enum defined_options { __VA_ARGS__ }; 
+#endif
+
+enum defined_options;
+
+class logged_options : public root 
+// TODO: HA, TADY TO MAME!! POKUD ZDE CHCEME TEZ UZIVAT FROMSETTING A TOSETTING, NEMUZOU BYT LOGOVACI
+// VECI PRIMO V ROOTU.. RESENIM BUDE ZREJME KOMPOZICE - FUNKCNOST SOUVISEJICI S LOGGERAMA UMISTENA V ROOTU 
+// PREJDE DO TETO TRIDY, A KDO BUDE MIT ZAJEM O NAPOJENI NA LOGGERY MUSI OBSAHOVAT LOGGED_OPTIONS INSTANCI... 
+// TZN. TRIDU LOGGED OPTIONS BUDE JESTE TREBA LEHCE ROZSIRIT..
+// KOMPOZICE TAKY UMOZNI NEKOLIK RUZNYCH LOGGERU PRO JEDEN OBJEKT.. PROSTE BUDE OBSHOVAT NEKOLIK RUZNYCH 
+// LOGGED_OPTIONS INSTANCI NAPOJENYCH NA RUZNE LOGGERY.. HMM, ALE TO JE TREBA JESTE DOMYSLET.)
+{
+private:
+	bitset<32> values;
+
+	static const Array<string> names; 
+
+public:
+	
+	bool operator [] (const defined_options &option )
+	{
+		return values[option];
+	}
+
+	void from_setting ( const Setting &set )
+	{
+		values.reset();
+		Array<string> true_options;
+		UI::get( true_options, set );
+		for( int i = 0; i < true_options.length(); i++ )
+			for( int j = 0; j < names.length(); j++ )
+				if( true_options(i) == names(j)  ) 
+				{
+					values[j] = true;
+					break;
+				} // TODO kdyz ho to vubec nenajde, nic se nedeje.. coz radeji vyhodit UI vyjimku??!
+	}
+	
+	void to_setting( Setting &set ) const
+	{
+		Array<string> true_options( values.count() );
+		int true_options_count = 0;
+		for( unsigned int i = 0; i < values.size(); i++ )
+			if( values[i] ) 
+				true_options( true_options_count++ ) = names(i);
+		UI::save( true_options, set );
+	}
+};
+UIREGISTER(logged_options);
+DEFINED_OPTIONS(bounds,likelyhood,full);
+
+
 class BM : public root {
 protected:
@@ -1085,7 +1145,4 @@
 	//!@{
 
-	//! Set boolean options from a string, recognized are: "logbounds,logll"
-	virtual void set_options ( const string &opt );
-
 	//! Add all logged variables to a logger
 	//! Log levels two digits: xy where
@@ -1096,4 +1153,9 @@
 	//! Save results to the given logger, details of what is stored is configured by \c LIDs and \c options
 	virtual void log_write ( ) const;
+
+
+	// TOHLE EFEKTIVNE NAHRAZUJE loglevel
+	// TODO pozdeji dat private
+	logged_options logged;
 
 	//!@}
@@ -1112,9 +1174,7 @@
 		}
 
-		string opt;
-		if ( UI::get ( opt, set, "options", UI::optional ) ) {
-			set_options ( opt );
-		}
-	}
+		UI::get ( logged, set, "logged", UI::optional );
+	}
+
 
 	void to_setting ( Setting &set ) const {
@@ -1123,22 +1183,32 @@
 		UI::save( &rvc, set, "rvc" );		
 		UI::save( &posterior()._rv(), set, "rv" );
-
-		string opt;
-		switch( posterior()._log_level() )
-		{
-		case 2:
-			opt = "logbounds ";
-			break;
-		case 10:
-			opt = "logfull ";
-			break;
-		default:
-			opt = "";
-			break;
+		UI::save( &posterior()._rv(), set, "rv" );
+		UI::save( &logged, set, "logged" );
+	}
+
+	virtual void set_options ( const string &  ); 
+	
+	// TODO JEN JAKO UKAZKA POUZIT LOGGED[..], NAKONEC ODSTRANIT CELOU METODU, A TAKY JEJI ORIGINAL VYSE
+	// jen co zavedeme logged_options i do dalsich objektu, pak se vse muze nastavovat primo 
+	// ve from_settingu, bude to tak ok? 
+	// nejlepsi by bylo, kdyby se options posterioru() nastavovaly v jeho from_settingu, 
+	// aby nevznikala takovahle kaskada zavislosti.. pujde to? domyslet
+	virtual void SHOWING_ROOM( const string &  )
+	{
+		if ( logged[full] ) {
+			const_cast<epdf&> ( posterior() ).set_log_level ( 10 ) ;
+		} else {
+			if ( logged[bounds]  ) {
+				const_cast<epdf&> ( posterior() ).set_log_level ( 2 ) ;
+			} else {
+				const_cast<epdf&> ( posterior() ).set_log_level ( 1 ) ;
+			}
+			if ( logged[likelyhood]  ) {
+				log_level = 1;
+			}
 		}
-		if( log_level == 1 ) opt = opt + "logll";
-		if( !opt.empty() )
-			UI::save( opt, set, "options" );
-	}
+	}
+
+
 };
 
