Changeset 769
- Timestamp:
- 01/12/10 20:25:33 (15 years ago)
- Location:
- library/bdm
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified library/bdm/bdmroot.cpp ¶
r706 r769 3 3 //! Space of basic BDM structures 4 4 namespace bdm { 5 6 void UI_DBG (const Setting &S, const string &spc, ostream &out =cout){ 7 const char *Name=S.getName(); 8 if ( Name!=NULL ) {out << spc << std::string ( Name );}; 9 Setting::Type T=S.getType(); 10 switch ( T ) { 11 case Setting::TypeArray: 12 out << endl; 13 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" ", out);}; 14 break; 15 case Setting::TypeList: 16 out << endl; 17 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" ", out );}; 18 break; 19 case Setting::TypeGroup: 20 out << endl; 21 for ( int i=0;i<S.getLength();i++ ) {UI_DBG ( S[i], spc+" ", out );} 22 break; 23 case Setting::TypeInt: 24 out << " = "; 25 out << int ( S ) <<endl; 26 break; 27 case Setting::TypeFloat: 28 out << " = "; 29 out << double ( S ) <<endl; 30 break; 31 case Setting::TypeString: 32 out << " = "; 33 out << ( const char* ) ( S ) <<endl; 34 break; 35 case Setting::TypeBoolean: 36 out << " = "; 37 out << bool ( S ) <<endl; 38 break; 39 default: {out << "?";}; 40 }; 41 } 42 5 43 } -
TabularUnified library/bdm/bdmroot.h ¶
r766 r769 27 27 namespace bdm { 28 28 29 30 //! auxiliary function for debugging 31 void UI_DBG (const Setting &S, const string &spc, ostream &out ); 32 29 33 //forward declaration 30 34 class logger; … … 74 78 } 75 79 76 //! Returns abasic textual info about the current instance80 //! Returns basic textual info about the current instance 77 81 virtual string to_string() const { 78 return ""; 82 Config C; 83 Setting &set=C.getRoot(); 84 this->to_setting(set); 85 ostringstream os; 86 UI_DBG(set, "", os); 87 return os.str(); 79 88 } 80 89 //! Register itself in a logger, i.e. allocate space for data from this class