Skip to content

Commit e182737

Browse files
committed
Build with std::map support
1 parent 839d2d1 commit e182737

File tree

2 files changed

+66
-18
lines changed

2 files changed

+66
-18
lines changed

build/jsroot.js

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const version_id = 'dev',
1414

1515
/** @summary version date
1616
* @desc Release date in format day/month/year like '14/04/2022' */
17-
version_date = '12/02/2026',
17+
version_date = '13/02/2026',
1818

1919
/** @summary version id and date
2020
* @desc Produced by concatenation of {@link version_id} and {@link version_date}
@@ -178365,17 +178365,20 @@ class ReaderItem {
178365178365

178366178366
constructor(column, name) {
178367178367
this.column = column;
178368-
this.id = column.index;
178369-
this.coltype = column.coltype;
178370-
this.splittype = 0;
178371-
this.page = -1; // current page for the reading
178372178368
this.name = name;
178369+
this.id = -1;
178370+
this.coltype = 0;
178373178371
this.sz = 0;
178374178372
this.simple = true;
178373+
this.page = -1; // current page for the reading
178374+
178375+
if (this.column) {
178376+
this.id = column.index;
178377+
this.coltype = column.coltype;
178378+
}
178375178379

178376178380
// special handling of split types
178377178381
if ((this.coltype >= ENTupleColumnType.kSplitInt16) && (this.coltype <= ENTupleColumnType.kSplitIndex64)) {
178378-
this.splittype = this.coltype;
178379178382
this.coltype -= (ENTupleColumnType.kSplitInt16 - ENTupleColumnType.kInt16);
178380178383
this.simple = false;
178381178384
}
@@ -178390,8 +178393,10 @@ class ReaderItem {
178390178393
init_o() {
178391178394
this.o = 0;
178392178395
this.o2 = 0; // for bit count
178393-
this.view = this.views.shift();
178394-
this.view_len = this.view.byteLength;
178396+
if (this.column && this.views?.length) {
178397+
this.view = this.views.shift();
178398+
this.view_len = this.view.byteLength;
178399+
}
178395178400
}
178396178401

178397178402
shift_o(sz) {
@@ -178566,8 +178571,8 @@ class ReaderItem {
178566178571
};
178567178572
}
178568178573

178569-
/** @summary implement reading of std::vector where itemv provides element reading */
178570-
assignVectorReader(itemv) {
178574+
/** @summary implement reading of std collection where itemv provides element reading */
178575+
assignCollectionReader(itemv) {
178571178576
this.itemv = itemv;
178572178577
this.offv0 = 0;
178573178578

@@ -178607,7 +178612,40 @@ class ReaderItem {
178607178612
};
178608178613
}
178609178614

178615+
/** @summary implement reading of std::pair where item1 reads first (key) element */
178616+
assignPairReader(item_p1, item_p2) {
178617+
this.item_p1 = item_p1;
178618+
this.item_p2 = item_p2;
178619+
178620+
item_p1.func_p1 = item_p1.func;
178621+
item_p1.shift_p1 = item_p1.shift;
178622+
item_p2.func_p2 = item_p2.func;
178623+
item_p2.shift_p2 = item_p2.shift;
178624+
// assign noop
178625+
item_p1.func = item_p1.shift = item_p2.func = item_p2.shift = () => {};
178626+
178627+
// remember own read function - they need to be used
178628+
this.func = function(tgtobj) {
178629+
const res = {};
178630+
this.item_p1.func_p1(res);
178631+
this.item_p2.func_p2(res);
178632+
tgtobj[this.name] = res;
178633+
};
178634+
178635+
this.shift = function(entries) {
178636+
if (entries > 0) {
178637+
this.item_p1.shift_p1(entries);
178638+
this.item_p2.shift_p2(entries);
178639+
}
178640+
};
178641+
}
178642+
178643+
178610178644
collectPages(cluster_locations, dataToRead, itemsToRead, pagesToRead, emin, emax, elist) {
178645+
// no pages without real column id
178646+
if (!this.column || (this.id < 0))
178647+
return;
178648+
178611178649
const pages = cluster_locations[this.id].pages;
178612178650

178613178651
this.views = new Array(pages.length);
@@ -178772,25 +178810,35 @@ async function rntupleProcess(rntuple, selector, args = {}) {
178772178810
}
178773178811

178774178812
function addFieldReading(field, tgtname) {
178775-
const columns = rntuple.builder.findColumns(field);
178776-
if (!columns?.length)
178813+
const columns = rntuple.builder.findColumns(field),
178814+
childs = rntuple.builder.findChildFields(field);
178815+
if (!columns?.length) {
178816+
if ((childs.length === 2) && (field.typeName.indexOf('std::pair') === 0)) {
178817+
const item1 = addFieldReading(childs[0], 'first'),
178818+
item2 = addFieldReading(childs[1], 'second'),
178819+
item = new ReaderItem(null, tgtname);
178820+
handle.arr.push(item);
178821+
item.assignPairReader(item1, item2);
178822+
return item;
178823+
}
178824+
178777178825
throw new Error(`No columns found for field '${field.fieldName}' in RNTuple`);
178826+
}
178778178827

178779-
let item = new ReaderItem(columns[0], tgtname);
178828+
const item = new ReaderItem(columns[0], tgtname);
178780178829
item.assignReadFunc();
178781178830
handle.arr.push(item);
178782178831

178783178832
if ((columns.length === 2) && (field.typeName === 'std::string')) {
178784178833
const items = new ReaderItem(columns[1], tgtname);
178785178834
items.assignStringReader(item);
178786178835
handle.arr.push(items);
178787-
item = items; // second item performs complete reading of the string
178836+
return items; // second item performs complete reading of the string
178788178837
}
178789178838

178790-
const childs = rntuple.builder.findChildFields(field);
178791-
if ((childs.length === 1) && (field.typeName.indexOf('std::vector') === 0)) {
178839+
if ((childs.length === 1) && (field.typeName.indexOf('std::vector') === 0 || field.typeName.indexOf('std::map') === 0)) {
178792178840
const itemv = addFieldReading(childs[0], tgtname);
178793-
item.assignVectorReader(itemv);
178841+
item.assignCollectionReader(itemv);
178794178842
}
178795178843

178796178844
return item;

modules/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const version_id = 'dev',
66

77
/** @summary version date
88
* @desc Release date in format day/month/year like '14/04/2022' */
9-
version_date = '12/02/2026',
9+
version_date = '13/02/2026',
1010

1111
/** @summary version id and date
1212
* @desc Produced by concatenation of {@link version_id} and {@link version_date}

0 commit comments

Comments
 (0)