Skip to content

Commit 4df8bec

Browse files
committed
[ntuple] add cloning for RImplSimple-based writer
1 parent 4954ae0 commit 4df8bec

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tree/ntuple/src/RMiniFile.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,14 @@ ROOT::Internal::RNTupleFileWriter::CloneWithDifferentName(std::string_view ntupl
13271327
{
13281328
if (auto *file = std::get_if<RImplTFile>(&fFile)) {
13291329
return Append(ntupleName, *file->fDirectory, fNTupleAnchor.fMaxKeySize);
1330+
} else if (auto *file = std::get_if<RImplSimple>(&fFile)) {
1331+
auto writer = std::unique_ptr<RNTupleFileWriter>(new RNTupleFileWriter(ntupleName, fNTupleAnchor.GetMaxKeySize()));
1332+
auto &clonedFile = std::get<RImplSimple>(writer->fFile);
1333+
clonedFile.fShared = file->fShared;
1334+
clonedFile.fDirectIO = file->fDirectIO;
1335+
// TODO: use passed options
1336+
clonedFile.AllocateBuffers(RNTupleWriteOptions().GetWriteBufferSize());
1337+
return writer;
13301338
}
13311339
// TODO: support also non-TFile-based writers
13321340
throw ROOT::RException(R__FAIL("cannot clone a non-TFile-based RNTupleFileWriter."));

0 commit comments

Comments
 (0)