Skip to content

Commit 44fae1c

Browse files
committed
Build with rntuple streamed elements
1 parent 093163a commit 44fae1c

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

build/jsroot.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178583,6 +178583,53 @@ class StringReaderItem extends ReaderItem {
178583178583

178584178584
}
178585178585

178586+
/** @class reading Streamed field
178587+
* @private */
178588+
178589+
class StreamedReaderItem extends ReaderItem {
178590+
178591+
constructor(items, name, file, classname) {
178592+
super(items, name);
178593+
items[0]._is_offset_item = true;
178594+
items[1].set_not_simple();
178595+
this.file = file;
178596+
this.classname = classname;
178597+
this.off0 = 0;
178598+
}
178599+
178600+
reset_extras() {
178601+
this.off0 = 0;
178602+
}
178603+
178604+
func(tgtobj) {
178605+
const tmp = {}, res = {};
178606+
this.items[0].func(tmp);
178607+
const off = Number(tmp.len),
178608+
buf = new TBuffer(this.items[1].view, this.items[1].o, this.file, this.items[1].o + off - this.off0);
178609+
178610+
// TODO: if by chance object splited between two pages
178611+
if (this.items[1].view.byteLength < this.items[1].o + off - this.off0)
178612+
console.error('FAILURE - buffer is splitted, need to be read from next page');
178613+
178614+
buf.classStreamer(res, this.classname);
178615+
178616+
this.items[1].shift_o(off - this.off0);
178617+
this.off0 = off;
178618+
tgtobj[this.name] = res;
178619+
}
178620+
178621+
shift(entries) {
178622+
this.items[0].shift(entries - 1);
178623+
const tmp = {};
178624+
this.items[0].func(tmp);
178625+
const off = Number(tmp.len);
178626+
this.items[1].shift_o(off - this.off0);
178627+
this.off0 = off;
178628+
}
178629+
178630+
}
178631+
178632+
178586178633
/** @class reading of std::array<T,N>
178587178634
* @private */
178588178635

@@ -178900,6 +178947,7 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178900178947
return new TupleReaderItem(items, tgtname);
178901178948
}
178902178949

178950+
// this is custom class which is decomposed on several fields
178903178951
if ((childs.length > 0) && field.checksum && field.typeName) {
178904178952
const items = [];
178905178953
for (let i = 0; i < childs.length; ++i)
@@ -178921,6 +178969,14 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178921178969
return new BitsetReaderItem([itembit], tgtname, Number(field.arraySize));
178922178970
}
178923178971

178972+
if ((columns.length === 2) && field.checksum && field.typeName) {
178973+
if (!handle.file.getStreamer(field.typeName, { checksum: field.checksum }))
178974+
throw new Error(`No streamer for type '${field.typeName}' checksum ${field.checksum}`);
178975+
178976+
const itemlen = addColumnReadout(columns[0], 'len'),
178977+
itemb = addColumnReadout(columns[1], 'b');
178978+
return new StreamedReaderItem([itemlen, itemb], tgtname, handle.file, field.typeName);
178979+
}
178924178980

178925178981
let is_stl = false;
178926178982
['vector', 'map', 'unordered_map', 'multimap', 'unordered_multimap', 'set', 'unordered_set', 'multiset', 'unordered_multiset'].forEach(name => {

changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- `std::bitset`
1414
- `std::atomic`
1515
- simple custom classes
16+
- streamed types
1617
1. Resort order of ranges in http request, fixing several long-standing problems #374
1718
1. Implement for `TPie` 3d, text, title drawing including interactivity
1819
1. Implement `TCanvas` support in `build3d` function #373

0 commit comments

Comments
 (0)