Changeset 248 for bdm/uibuilder.h

Show
Ignore:
Timestamp:
01/26/09 20:28:46 (15 years ago)
Author:
smidl
Message:

doc

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • bdm/uibuilder.h

    r246 r248  
    1 #include <libconfig.h++> 
     1#include "libconfig/libconfig.h++" 
    22#include <itpp/itbase.h> 
    33 
     
    7575        public: 
    7676                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; 
    7878}; 
    7979 
     
    9090}; 
    9191 
     92//! Prototype of a UI builder. Return value is by the second argument since it allows some type of type checking. 
    9293template<class T> 
    9394void UIbuild(Setting &S, T** ret){ 
    9495        CHECK_UITYPE(S,TypeGroup); 
    9596        T* tmp; 
     97        // Check if field "type" is present, if not it is not a valid UI 
    9698        it_assert_debug(S.exists("type"), string(S.getPath())+" is not a valid UI!"); 
    9799                 
    98100        const string typ=S["type"]; 
     101        // Find "type" in list of registred UI builders 
    99102        UImap::const_iterator iter = __uimap__.find( typ ); 
    100103        if( iter == __uimap__.end()) { 
    101104                it_error("UI of type \"" + typ + "\" is not registered!"); 
    102105        } 
    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        } 
    104111        // make assignment 
    105112        *ret=tmp;