Show
Ignore:
Timestamp:
09/13/09 23:14:23 (15 years ago)
Author:
smidl
Message:

remove "delays" from memory DS, check length of datasource

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/datasources.h

    r604 r609  
    3535                //!  vector of rows that are presented in Dt 
    3636                ivec rowid; 
    37                 //! vector of delays that are presented in Dt 
    38                 ivec delays; 
    39  
    40         public: 
     37 
     38        public: 
     39                int max_length() {return Data.cols();} 
    4140                void getdata ( vec &dt ); 
    4241                void getdata ( vec &dt, const ivec &indeces ); 
     
    5453                //!Default constructor 
    5554                MemDS () {}; 
    56                 MemDS ( mat &Dat, ivec &rowid0, ivec &delays0 ); 
    57 }; 
     55                MemDS ( mat &Dat, ivec &rowid0); 
     56                /*! Create object from the following structure 
     57                \code 
     58                { class = 'MemDS'; 
     59                   Data = (...);            // Data matrix or data vector 
     60                   --- optional --- 
     61                   drv = {class='RV'; ...} // Identification how rows of the matrix Data will be known to others 
     62                   time = 0;               // Index of the first column to user_info, 
     63                   rowid = [1,2,3...];     // ids of rows to be used 
     64                } 
     65                \endcode 
     66                 
     67                If the optional fields are not given, they will be filled as follows: 
     68                \code 
     69                rowid= [0, 1, 2, ...number_of_rows_of_Data]; 
     70                drv = {names=("0", "1", "2", ..."number_of_rows_of_Data"); 
     71                      sizes=( 1    1    1 ...); 
     72                          times=( 0    0    0 ...); 
     73                          }; 
     74                time = 0; 
     75                \endcode 
     76                If \c rowid is given, \c drv will be named after indeces in rowids. 
     77                 
     78                Hence the data provided by method \c getdata() will be full column of matrix Data starting from the first record.  
     79                */ 
     80                void from_setting(const Setting &set){ 
     81                        UI::get(Data, set, "Data", UI::compulsory); 
     82                        if(!UI::get(time, set,"time", UI::optional)) {time =0;} 
     83                        if(!UI::get(rowid, set, "rowid",UI::optional)) {rowid =linspace(0,Data.rows()-1);} 
     84                        shared_ptr<RV> r=UI::build<RV>(set,"drv",UI::optional); 
     85                        if (!r) {r=new RV(); 
     86                                for (int i=0; i<rowid.length(); i++){ r->add(RV("ch"+num2str(rowid(i)), 1, 0));} 
     87                        } 
     88                        set_drv(*r,RV()); //empty urv 
     89                        dtsize=r->_dsize(); 
     90                        utsize=0; 
     91                } 
     92}; 
     93UIREGISTER(MemDS); 
    5894 
    5995/*!  \brief Simulate data from a static pdf