root/applications/bdmtoolbox/mex/class_defaults.cpp @ 962

Revision 962, 1.4 kB (checked in by smidl, 14 years ago)

New class defaults + correction of log_level save

Line 
1/*!
2\file
3\brief check how the structure is processed
4
5
6 */
7
8#include <stat/emix.h>
9#include <estim/particles.h>
10#include <estim/kalman.h>
11#include <mpdm/arx_agent.h>
12
13
14using namespace bdm;
15
16#ifdef MEX
17#include <mex/mex_parser.h>
18#include <mex/mex_function.h>
19#include <mex/mex_BM.h>
20
21void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) {
22        // Check the number of inputs and output arguments
23        if ( n_input<1 ) mexErrMsgTxt ( "Usage:\n"
24                                                "instance=class_defaults(struct)\n"
25                                                "  struct              % configuration structure of a class\n"
26                                                "output:\n"
27                                                "  the same structure filled with the defaults.\n\n"
28                                                "This operation is usefull for obtaining info about class defaults, or success of passing info to it" );
29
30        RV::clear_all();
31        //CONFIG
32        UImxArray Cfg(input[0]);
33        Cfg.writeFile("class_defaults.cfg");
34        if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" );
35       
36#else
37        int main ( int argc, char* argv[] ) {
38                const char *fname;
39                if ( argc>1 ) {
40                        fname = argv[1];
41                } else {
42                        fname="class_defaults.cfg";
43                }
44                UIFile Cfg ( fname );
45#endif
46               
47        shared_ptr<root> r=UI::build<root>(Cfg);
48
49#ifdef MEX
50        UImxArray Ret;
51        UI::save(*r, Ret);
52       
53        output[0] = Ret.create_mxArray();
54#else
55        UIFile Out;
56        UI::save(*r,Out);
57        Out.writeFile("defaults");
58#endif
59}
Note: See TracBrowser for help on using the browser.