| 127 | } |
| 128 | |
| 129 | int cDataReader::myConfigureInstance() |
| 130 | { |
| 131 | int i; |
| 132 | |
| 133 | for (i=0; i<nLevels; i++) { |
| 134 | // find our read levels... the dataWriters should create them in their configure method |
| 135 | level[i] = dm->findLevel(dmLevel[i]); |
| 136 | if (level[i] < 0) { |
| 137 | SMILE_IDBG(3,"level='%s' not yet available, waiting!",dmLevel[i]); |
| 138 | return 0; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | for (i=0; i<nLevels; i++) { |
| 143 | // setup the reader blocksize and get read level config |
| 144 | const sDmLevelConfig * c; |
| 145 | if (lengthM_sec >= 0.0) { |
| 146 | c = dm->queryReadConfig( level[i], lengthM_sec ); |
| 147 | } else { |
| 148 | long tmp = (long)lengthM; |
| 149 | //if (tmp < 1) tmp = 1; |
| 150 | c = dm->queryReadConfig( level[i], tmp ); |
| 151 | } |
| 152 | // TODO: merge config from various levels.... |
| 153 | |
| 154 | //... |
| 155 | if ((myLcfg==NULL)&&(c!=NULL)) { |
| 156 | myLcfg = new sDmLevelConfig(*c); |
| 157 | // we do not want to inherit noTimeMeta as it should be opt-in for every level, |
| 158 | // thus we explicitly clear the flag |
| 159 | myLcfg->noTimeMeta = false; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | if (myLcfg == NULL) { |
| 164 | SMILE_IERR(1,"reader level config could not be set in myConfigureInstance for an unknown reason!"); |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | // now update stepM and lengthM from stepM_frames and lengthM_frames: |
| 169 | if (stepM < 0) { |
| 170 | if (myLcfg->T != 0.0) { |
| 171 | stepM = (long)round( stepM_sec / myLcfg->T ); |
| 172 | ignMisBegM = (long)round( ignMisBegM_sec / myLcfg->T ); |
| 173 | } else { |
| 174 | stepM = (long)round( stepM_sec ); |
| 175 | ignMisBegM = (long)round( ignMisBegM_sec ); |
| 176 | } |
| 177 | curR = ignMisBegM; |
| 178 | } |
| 179 | |
| 180 | if (lengthM < 0) { |
| 181 | if (myLcfg->T != 0.0) { |
| 182 | lengthM = (long)round( lengthM_sec / myLcfg->T ); |
| 183 | } else { |
| 184 | lengthM = (long)round( lengthM_sec ); |
| 185 | } |
| 186 | } |
nothing calls this directly
no test coverage detected