Changeset 248 for bdm/uibuilder.h
- Timestamp:
- 01/26/09 20:28:46 (15 years ago)
- Files:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
bdm/uibuilder.h
r246 r248 1 #include <libconfig.h++>1 #include "libconfig/libconfig.h++" 2 2 #include <itpp/itbase.h> 3 3 … … 75 75 public: 76 76 UIbuilder(const string &typ){__uimap__.insert(make_pair(typ,this));} 77 virtual void build(Setting &S, void** result) const {it_error("Calling uibuilder basic" );};77 virtual void build(Setting &S, void** result) const =0; 78 78 }; 79 79 … … 90 90 }; 91 91 92 //! Prototype of a UI builder. Return value is by the second argument since it allows some type of type checking. 92 93 template<class T> 93 94 void UIbuild(Setting &S, T** ret){ 94 95 CHECK_UITYPE(S,TypeGroup); 95 96 T* tmp; 97 // Check if field "type" is present, if not it is not a valid UI 96 98 it_assert_debug(S.exists("type"), string(S.getPath())+" is not a valid UI!"); 97 99 98 100 const string typ=S["type"]; 101 // Find "type" in list of registred UI builders 99 102 UImap::const_iterator iter = __uimap__.find( typ ); 100 103 if( iter == __uimap__.end()) { 101 104 it_error("UI of type \"" + typ + "\" is not registered!"); 102 105 } 103 else {const UIbuilder* is= iter->second; is->build(S,reinterpret_cast<void**>(&tmp));} 106 else { 107 const UIbuilder* is= iter->second; 108 //BUILD the result 109 is->build(S,reinterpret_cast<void**>(&tmp)); 110 } 104 111 // make assignment 105 112 *ret=tmp;