25 : fModel(model), fIndex(index)
31 if (!fWritePage[0].IsNull())
32 fPageSink->ReleasePage(fWritePage[0]);
33 if (!fWritePage[1].IsNull())
34 fPageSink->ReleasePage(fWritePage[1]);
35 if (!fReadPage.IsNull())
36 fPageSource->ReleasePage(fReadPage);
38 fPageSink->DropColumn(fHandleSink);
40 fPageSource->DropColumn(fHandleSource);
45 switch (pageStorage->
GetType()) {
47 fPageSink =
static_cast<RPageSink*
>(pageStorage);
48 fHandleSink = fPageSink->
AddColumn(fieldId, *
this);
49 fApproxNElementsPerPage = fPageSink->GetWriteOptions().GetApproxUnzippedPageSize() / fElement->GetSize();
50 if (fApproxNElementsPerPage < 2)
53 fWritePage[0] = fPageSink->ReservePage(fHandleSink, fApproxNElementsPerPage + fApproxNElementsPerPage / 2);
54 fWritePage[1] = fPageSink->ReservePage(fHandleSink, fApproxNElementsPerPage + fApproxNElementsPerPage / 2);
57 fPageSource =
static_cast<RPageSource*
>(pageStorage);
58 fHandleSource = fPageSource->
AddColumn(fieldId, *
this);
59 fNElements = fPageSource->GetNElements(fHandleSource);
60 fColumnIdSource = fPageSource->GetColumnId(fHandleSource);
69 auto otherIdx = 1 - fWritePageIdx;
70 if (fWritePage[fWritePageIdx].IsEmpty() && fWritePage[otherIdx].IsEmpty())
73 if ((fWritePage[fWritePageIdx].GetNElements() < fApproxNElementsPerPage / 2) && !fWritePage[otherIdx].IsEmpty()) {
75 void *dst = fWritePage[otherIdx].GrowUnchecked(fWritePage[fWritePageIdx].GetNElements());
76 RColumnElementBase elem(fWritePage[fWritePageIdx].GetBuffer(), fWritePage[fWritePageIdx].GetElementSize());
77 elem.
WriteTo(dst, fWritePage[fWritePageIdx].GetNElements());
78 fWritePage[fWritePageIdx].Reset(0);
79 std::swap(fWritePageIdx, otherIdx);
82 R__ASSERT(fWritePage[otherIdx].IsEmpty());
83 fPageSink->CommitPage(fHandleSink, fWritePage[fWritePageIdx]);
84 fWritePage[fWritePageIdx].Reset(fNElements);
89 fPageSource->ReleasePage(fReadPage);
90 fReadPage = fPageSource->PopulatePage(fHandleSource, index);
95 fPageSource->ReleasePage(fReadPage);
96 fReadPage = fPageSource->PopulatePage(fHandleSource, clusterIndex);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
void WriteTo(void *destination, std::size_t count) const
Write one or multiple column elements into destination.
void Connect(DescriptorId_t fieldId, RPageStorage *pageStorage)
void MapPage(const NTupleSize_t index)
RColumn(const RColumnModel &model, std::uint32_t index)
Abstract interface to write data into an ntuple.
ColumnHandle_t AddColumn(DescriptorId_t fieldId, const RColumn &column) final
Register a new column.
Abstract interface to read data from an ntuple.
ColumnHandle_t AddColumn(DescriptorId_t fieldId, const RColumn &column) override
Register a new column.
Common functionality of an ntuple storage for both reading and writing.
virtual EPageStorageType GetType()=0
Whether the concrete implementation is a sink or a source.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Holds the static meta-data of a column in a tree.
Base class for all ROOT issued exceptions.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.