|
1409 | 1409 | staged_prev: 0, // entry limit of previous I/O request
|
1410 | 1410 | staged_now: 0, // entry limit of current I/O request
|
1411 | 1411 | progress_showtm: 0, // last time when progress was showed
|
1412 |
| - GetBasketEntry : function(k) { |
| 1412 | + GetBasketEntry: function(k) { |
1413 | 1413 | if (!this.branch || (k > this.branch.fMaxBaskets)) return 0;
|
1414 | 1414 | var res = (k < this.branch.fMaxBaskets) ? this.branch.fBasketEntry[k] : 0;
|
1415 | 1415 | if (res) return res;
|
1416 | 1416 | var bskt = (k>0) ? this.branch.fBaskets.arr[k-1] : null;
|
1417 | 1417 | return bskt ? (this.branch.fBasketEntry[k-1] + bskt.fNevBuf) : 0;
|
1418 | 1418 | },
|
1419 |
| - LocateBuffer : function(entry) { |
1420 |
| - // locate buffer position like GetEntry() |
| 1419 | + GetTarget: function(tgtobj) { |
| 1420 | + // returns target object which should be used for the branch reading |
| 1421 | + if (!this.tgt) return tgtobj; |
| 1422 | + for (var k=0;k<this.tgt.length;++k) { |
| 1423 | + var sub = this.tgt[k]; |
| 1424 | + if (!tgtobj[sub.name]) tgtobj[sub.name] = sub.lst.Create(); |
| 1425 | + tgtobj = tgtobj[sub.name]; |
| 1426 | + } |
| 1427 | + return tgtobj; |
| 1428 | + }, |
| 1429 | + GetEntry: function(entry, tgtobj) { |
| 1430 | + // This should be equivalent to TBranch::GetEntry() method |
1421 | 1431 | var shift = entry - this.first_entry, off;
|
1422 | 1432 | if (!this.branch.TestBit(JSROOT.IO.BranchBits.kDoNotUseBufferMap))
|
1423 | 1433 | this.raw.ClearObjectMap();
|
|
1429 | 1439 | off = this.basket.fKeylen + this.basket.fNevBufSize * shift;
|
1430 | 1440 | }
|
1431 | 1441 | this.raw.locate(off - this.raw.raw_shift);
|
1432 |
| - }, |
1433 |
| - GetTarget : function(tgtobj) { |
1434 |
| - if (!this.tgt) return tgtobj; |
1435 |
| - for (var k=0;k<this.tgt.length;++k) { |
1436 |
| - var sub = this.tgt[k]; |
1437 |
| - if (!tgtobj[sub.name]) tgtobj[sub.name] = sub.lst.Create(); |
1438 |
| - tgtobj = tgtobj[sub.name]; |
1439 |
| - } |
1440 |
| - return tgtobj; |
| 1442 | + |
| 1443 | + this.member.func(this.raw, this.GetTarget(tgtobj)); |
1441 | 1444 | }
|
1442 | 1445 | };
|
1443 | 1446 |
|
|
2043 | 2046 | handle.selector.ShowProgress(portion);
|
2044 | 2047 | }
|
2045 | 2048 |
|
2046 |
| - function ReadBasketEntryOffset(branch, basket, buf) { |
2047 |
| - if (branch.fEntryOffsetLen <= 0) return; |
2048 |
| - |
2049 |
| - // ready entry offest len when necessary |
2050 |
| - |
2051 |
| - buf.locate(basket.fLast - buf.raw_shift); |
2052 |
| - |
2053 |
| - basket.fEntryOffset = buf.ReadFastArray(buf.ntoi4(), JSROOT.IO.kInt); |
2054 |
| - if (!basket.fEntryOffset) basket.fEntryOffset = [ basket.fKeylen ]; |
2055 |
| - |
2056 |
| - if (buf.remain() > 0) |
2057 |
| - basket.fDisplacement = buf.ReadFastArray(buf.ntoi4(), JSROOT.IO.kInt); |
2058 |
| - else |
2059 |
| - basket.fDisplacement = undefined; |
2060 |
| - |
2061 |
| - // rollback buffer - not needed in the future |
2062 |
| - // buf.locate(buf.raw_shift); |
2063 |
| - } |
2064 |
| - |
2065 | 2049 | function ProcessBlobs(blobs) {
|
2066 | 2050 | if (!blobs || ((places.length>2) && (blobs.length*2 !== places.length)))
|
2067 | 2051 | return JSROOT.CallBack(baskets_call_back, null);
|
|
2103 | 2087 |
|
2104 | 2088 | bitems[k].raw = buf; // here already unpacket buffer
|
2105 | 2089 |
|
2106 |
| - ReadBasketEntryOffset(bitems[k].branch, basket, buf); |
| 2090 | + if (bitems[k].branch.fEntryOffsetLen > 0) |
| 2091 | + buf.ReadBasketEntryOffset(basket, buf.raw_shift); |
2107 | 2092 | }
|
2108 | 2093 |
|
2109 | 2094 | if (ExtractPlaces())
|
|
2170 | 2155 | bitem.raw.locate(0); // reset pointer - same branch may be read several times
|
2171 | 2156 | else
|
2172 | 2157 | bitem.raw = JSROOT.CreateTBuffer(null, 0, handle.file); // create dummy buffer - basket has no data
|
2173 |
| - bitem.raw.raw_shift = 0; |
| 2158 | + bitem.raw.raw_shift = bskt.fKeylen; |
2174 | 2159 |
|
2175 |
| - if (bskt.fBufferRef) |
2176 |
| - ReadBasketEntryOffset(elem.branch, bskt, bitem.raw); |
| 2160 | + if (bskt.fBufferRef && (elem.branch.fEntryOffsetLen > 0)) |
| 2161 | + bitem.raw.ReadBasketEntryOffset(bskt, bitem.raw.raw_shift); |
2177 | 2162 |
|
2178 | 2163 | bitem.bskt_obj = bskt;
|
2179 | 2164 | is_direct = true;
|
|
2302 | 2287 |
|
2303 | 2288 | // main processing loop
|
2304 | 2289 | while(loopentries--) {
|
| 2290 | + |
2305 | 2291 | for (n=0;n<handle.arr.length;++n) {
|
2306 | 2292 | elem = handle.arr[n];
|
2307 | 2293 |
|
2308 | 2294 | // locate buffer offest at proper place
|
2309 |
| - elem.LocateBuffer(handle.current_entry); |
2310 |
| - |
2311 |
| - // read only element where entry id matches |
2312 |
| - elem.member.func(elem.raw, elem.GetTarget(handle.selector.tgtobj)); |
| 2295 | + elem.GetEntry(handle.current_entry, handle.selector.tgtobj); |
2313 | 2296 | }
|
2314 | 2297 |
|
2315 | 2298 | handle.selector.Process(handle.current_entry);
|
|
0 commit comments