root/bdm/stat/loggers_ui.h @ 278

Revision 278, 1.7 kB (checked in by smidl, 15 years ago)

props

  • Property svn:eol-style set to native
Line 
1
2/*!
3  \file
4  \brief UI builders for Loggers
5  \author Vaclav Smidl.
6
7  -----------------------------------
8  BDM++ - C++ library for Bayesian Decision Making under Uncertainty
9
10  Using IT++ for numerical operations
11  -----------------------------------
12*/
13
14#ifndef LGR_UI_H
15#define LGR_UI_H
16
17#include "loggers.h"
18#include "uibuilder.h"
19
20using namespace bdm;
21
22/*! \brief UI for class RV (description of data vectors)
23
24\code
25rv = {
26        type = "rv"; //identifier of the description
27        // UNIQUE IDENTIFIER same names = same variable
28        names = ["a", "b", "c", ...];   // which will be used e.g. in loggers
29
30        //optional arguments
31        sizes = [1, 2, 3, ...];         // (optional) default = ones()
32        times = [-1, -2, 0, ...];       // time shifts with respect to current time (optional) default = zeros()
33}
34\endcode
35*/
36class UIrv: public UIbuilder{
37        public:
38                UIrv():UIbuilder("rv"){};
39                bdmroot* build(Setting &S) const{
40                        Array<string> A=get_as(S["names"]);
41                        ivec szs;
42                        ivec tms;
43                        if (S.exists("sizes")){ 
44                                szs=getivec(S["sizes"]);
45                        } else {
46                                szs = ones_i(A.length());
47                        }
48                        if (S.exists("times")){ 
49                                tms=getivec(S["times"]);
50                        } else {
51                                tms = zeros_i(A.length());
52                        }
53                        RV *tmp = new RV(A,szs,tms);
54                        return tmp;
55                };
56};
57UIREGISTER(UIrv);
58
59/*! \brief UI for dirfilelog (Kst file format)
60\code
61logger = {
62        type = "dirfilelog";
63        dirmane = "directory_for_files"; // resulting files will be stored there
64        maxlen = 100;                    // size of memory buffer, when full results are written to disk
65}
66\endcode
67*/
68class UIdirfilelog : public UIbuilder {
69        public:
70        UIdirfilelog():UIbuilder("dirfilelog"){};
71        bdmroot* build(Setting &S) const{
72                return new dirfilelog(S["dirname"],S["maxlen"]);
73        };
74};
75
76UIREGISTER(UIdirfilelog);
77#endif // LGR_H
Note: See TracBrowser for help on using the browser.