Skip to content

Commit 95af80a

Browse files
hahnjodpiparo
authored andcommitted
[ntuple] Refactor TObject reading
... in preparation of RField<TObject>::ReadInCluster
1 parent 4031713 commit 95af80a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Diff for: tree/ntuple/inc/ROOT/RField.hxx

+1
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ protected:
471471
std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
472472

473473
std::size_t AppendImpl(const void *from) final;
474+
void ReadTObject(void *to, UInt_t uniqueID, UInt_t bits);
474475
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
475476

476477
void AfterConnectPageSource() final;

Diff for: tree/ntuple/src/RFieldMeta.cxx

+10-4
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ std::size_t ROOT::RField<TObject>::AppendImpl(const void *from)
981981
return nbytes;
982982
}
983983

984-
void ROOT::RField<TObject>::ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to)
984+
void ROOT::RField<TObject>::ReadTObject(void *to, UInt_t uniqueID, UInt_t bits)
985985
{
986986
// Cf. TObject::Streamer()
987987

@@ -990,15 +990,21 @@ void ROOT::RField<TObject>::ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void
990990
throw RException(R__FAIL("RNTuple I/O on referenced TObject is unsupported"));
991991
}
992992

993-
CallReadOn(*fSubfields[0], globalIndex, static_cast<unsigned char *>(to) + GetOffsetUniqueID());
993+
*reinterpret_cast<UInt_t *>(reinterpret_cast<unsigned char *>(to) + GetOffsetUniqueID()) = uniqueID;
994994

995995
const UInt_t bitIsOnHeap = obj->TestBit(TObject::kIsOnHeap) ? TObject::kIsOnHeap : 0;
996-
UInt_t bits;
997-
CallReadOn(*fSubfields[1], globalIndex, &bits);
998996
bits |= bitIsOnHeap | TObject::kNotDeleted;
999997
*reinterpret_cast<UInt_t *>(reinterpret_cast<unsigned char *>(to) + GetOffsetBits()) = bits;
1000998
}
1001999

1000+
void ROOT::RField<TObject>::ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to)
1001+
{
1002+
UInt_t uniqueID, bits;
1003+
CallReadOn(*fSubfields[0], globalIndex, &uniqueID);
1004+
CallReadOn(*fSubfields[1], globalIndex, &bits);
1005+
ReadTObject(to, uniqueID, bits);
1006+
}
1007+
10021008
void ROOT::RField<TObject>::AfterConnectPageSource()
10031009
{
10041010
if (GetOnDiskTypeVersion() != 1) {

0 commit comments

Comments
 (0)