Skip to content

Commit 618bd67

Browse files
committed
[ntuple] Refactor TObject reading
... in preparation of RField<TObject>::ReadInCluster
1 parent ab946e4 commit 618bd67

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

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

475475
std::size_t AppendImpl(const void *from) final;
476+
void ReadTObject(void *to, UInt_t uniqueID, UInt_t bits);
476477
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
477478

478479
void AfterConnectPageSource() final;

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

+10-4
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ std::size_t ROOT::RField<TObject>::AppendImpl(const void *from)
971971
return nbytes;
972972
}
973973

974-
void ROOT::RField<TObject>::ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to)
974+
void ROOT::RField<TObject>::ReadTObject(void *to, UInt_t uniqueID, UInt_t bits)
975975
{
976976
// Cf. TObject::Streamer()
977977

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

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

985985
const UInt_t bitIsOnHeap = obj->TestBit(TObject::kIsOnHeap) ? TObject::kIsOnHeap : 0;
986-
UInt_t bits;
987-
CallReadOn(*fSubfields[1], globalIndex, &bits);
988986
bits |= bitIsOnHeap | TObject::kNotDeleted;
989987
*reinterpret_cast<UInt_t *>(reinterpret_cast<unsigned char *>(to) + GetOffsetBits()) = bits;
990988
}
991989

990+
void ROOT::RField<TObject>::ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to)
991+
{
992+
UInt_t uniqueID, bits;
993+
CallReadOn(*fSubfields[0], globalIndex, &uniqueID);
994+
CallReadOn(*fSubfields[1], globalIndex, &bits);
995+
ReadTObject(to, uniqueID, bits);
996+
}
997+
992998
void ROOT::RField<TObject>::AfterConnectPageSource()
993999
{
9941000
if (GetOnDiskTypeVersion() != 1) {

0 commit comments

Comments
 (0)