Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RColumn.hxx
Go to the documentation of this file.
1/// \file ROOT/RColumn.hxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2018-10-09
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_RColumn
14#define ROOT_RColumn
15
16#include <ROOT/RConfig.hxx> // for R__likely
18#include <ROOT/RNTupleTypes.hxx>
19#include <ROOT/RPage.hxx>
20#include <ROOT/RPageStorage.hxx>
21
22#include <TError.h>
23
24#include <cstring> // for memcpy
25#include <memory>
26#include <utility>
27
28namespace ROOT::Internal {
29
30class RReadColumn;
31class RWriteColumn;
32
33// clang-format off
34/**
35\class ROOT::Internal::RColumn
36\ingroup NTuple
37\brief A column is a storage-backed array of a simple, fixed-size type, from which pages can be mapped into memory.
38*/
39// clang-format on
40class RColumn {
41protected:
42 /// The column id in the column descriptor, once connected to a sink or source
44 /// Used to pack and unpack pages on writing/reading
45 std::unique_ptr<ROOT::Internal::RColumnElementBase> fElement;
46 /// Columns belonging to the same field are distinguished by their order. E.g. for an std::string field, there is
47 /// the offset column with index 0 and the character value column with index 1.
48 std::uint32_t fIndex;
49 /// Fields can have multiple column representations, distinguished by representation index
50 std::uint16_t fRepresentationIndex;
52
53 RColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
54 : fIndex(columnIndex), fRepresentationIndex(representationIndex), fType(type)
55 {
56 }
57
58public:
59 enum class EColumnType {
60 kRead,
61 kWrite
62 };
63
64 RColumn(const RColumn &) = delete;
65 RColumn &operator=(const RColumn &) = delete;
66 virtual ~RColumn() = default;
67
68 // Static cast to the derived classes, defined at the end of the header
70 const RReadColumn *ForReading() const;
72 const RWriteColumn *ForWriting() const;
73
76 std::uint16_t GetBitsOnStorage() const
77 {
78 assert(fElement);
79 return static_cast<std::uint16_t>(fElement->GetBitsOnStorage());
80 }
81 std::optional<std::pair<double, double>> GetValueRange() const
82 {
83 assert(fElement);
84 return fElement->GetValueRange();
85 }
86 std::uint32_t GetIndex() const { return fIndex; }
87 std::uint16_t GetRepresentationIndex() const { return fRepresentationIndex; }
89
90 void SetBitsOnStorage(std::size_t bits) { fElement->SetBitsOnStorage(bits); }
91 void SetValueRange(double min, double max) { fElement->SetValueRange(min, max); }
92}; // class RColumn
93
94class RReadColumn : public RColumn {
95private:
96 /// The column team is a set of columns that serve the same column index for different representation IDs.
97 /// Initially, the team has only one member, the very column it belongs to. Through MergeTeams(), two columns
98 /// can join forces. The team is used to react on suppressed columns: if the current team member has a suppressed
99 /// column for a MapPage() call, it get the page from the active column in the corresponding cluster.
100 struct RTeam {
101 std::vector<RReadColumn *> fMembers;
102 std::size_t fLastGoodTeamIdx = 0;
103 };
104
106 /// The currently mapped page for reading
108 /// As an optimization, if unset the team contains consists of this column only.
109 std::unique_ptr<RTeam> fTeam;
110
111 RReadColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
112 : RColumn(type, columnIndex, representationIndex)
113 {
114 }
115
116public:
117 template <typename CppT>
118 static std::unique_ptr<RReadColumn>
119 Create(ROOT::ENTupleColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
120 {
121 auto column = std::unique_ptr<RReadColumn>(new RReadColumn(type, columnIdx, representationIdx));
122 column->fElement = ROOT::Internal::RColumnElementBase::Generate<CppT>(type);
123 return column;
124 }
125
126 ~RReadColumn();
127
128 /// Connect the column to a page source.
130
131 void Read(const ROOT::NTupleSize_t globalIndex, void *to)
132 {
133 if (!fReadPageRef.Get().Contains(globalIndex)) {
134 MapPage(globalIndex);
135 }
136 const auto elemSize = fElement->GetSize();
137 void *from = static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) +
138 (globalIndex - fReadPageRef.Get().GetGlobalRangeFirst()) * elemSize;
139 std::memcpy(to, from, elemSize);
140 }
141
142 void Read(RNTupleLocalIndex localIndex, void *to)
143 {
144 if (!fReadPageRef.Get().Contains(localIndex)) {
145 MapPage(localIndex);
146 }
147 const auto elemSize = fElement->GetSize();
148 void *from = static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) +
149 (localIndex.GetIndexInCluster() - fReadPageRef.Get().GetLocalRangeFirst()) * elemSize;
150 std::memcpy(to, from, elemSize);
151 }
152
153 void ReadV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t count, void *to)
154 {
155 const auto elemSize = fElement->GetSize();
156 auto tail = static_cast<unsigned char *>(to);
157
158 while (count > 0) {
159 if (!fReadPageRef.Get().Contains(globalIndex)) {
160 MapPage(globalIndex);
161 }
162 const ROOT::NTupleSize_t idxInPage = globalIndex - fReadPageRef.Get().GetGlobalRangeFirst();
163
164 const void *from = static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) + idxInPage * elemSize;
165 const ROOT::NTupleSize_t nBatch = std::min(fReadPageRef.Get().GetNElements() - idxInPage, count);
166
167 std::memcpy(tail, from, elemSize * nBatch);
168
169 tail += nBatch * elemSize;
170 count -= nBatch;
171 globalIndex += nBatch;
172 }
173 }
174
175 void ReadV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t count, void *to)
176 {
177 const auto elemSize = fElement->GetSize();
178 auto tail = static_cast<unsigned char *>(to);
179
180 while (count > 0) {
181 if (!fReadPageRef.Get().Contains(localIndex)) {
182 MapPage(localIndex);
183 }
185
186 const void *from = static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) + idxInPage * elemSize;
187 const ROOT::NTupleSize_t nBatch = std::min(count, fReadPageRef.Get().GetNElements() - idxInPage);
188
189 std::memcpy(tail, from, elemSize * nBatch);
190
191 tail += nBatch * elemSize;
192 count -= nBatch;
193 localIndex = RNTupleLocalIndex(localIndex.GetClusterId(), localIndex.GetIndexInCluster() + nBatch);
194 }
195 }
196
197 template <typename CppT>
198 CppT *Map(const ROOT::NTupleSize_t globalIndex)
199 {
200 ROOT::NTupleSize_t nItems;
201 return MapV<CppT>(globalIndex, nItems);
202 }
203
204 template <typename CppT>
205 CppT *Map(RNTupleLocalIndex localIndex)
206 {
207 ROOT::NTupleSize_t nItems;
208 return MapV<CppT>(localIndex, nItems);
209 }
210
211 template <typename CppT>
212 CppT *MapV(const ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
213 {
214 if (R__unlikely(!fReadPageRef.Get().Contains(globalIndex))) {
215 MapPage(globalIndex);
216 }
217 // +1 to go from 0-based indexing to 1-based number of items
218 nItems = fReadPageRef.Get().GetGlobalRangeLast() - globalIndex + 1;
219 return reinterpret_cast<CppT *>(static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) +
220 (globalIndex - fReadPageRef.Get().GetGlobalRangeFirst()) * sizeof(CppT));
221 }
222
223 template <typename CppT>
224 CppT *MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
225 {
226 if (!fReadPageRef.Get().Contains(localIndex)) {
227 MapPage(localIndex);
228 }
229 // +1 to go from 0-based indexing to 1-based number of items
230 nItems = fReadPageRef.Get().GetLocalRangeLast() - localIndex.GetIndexInCluster() + 1;
231 return reinterpret_cast<CppT *>(static_cast<unsigned char *>(fReadPageRef.Get().GetBuffer()) +
233 sizeof(CppT));
234 }
235
237 {
238 if (!fReadPageRef.Get().Contains(clusterIndex)) {
239 MapPage(clusterIndex);
240 }
241 return fReadPageRef.Get().GetClusterInfo().GetIndexOffset() + clusterIndex.GetIndexInCluster();
242 }
243
245 {
246 if (!fReadPageRef.Get().Contains(globalIndex)) {
247 MapPage(globalIndex);
248 }
250 globalIndex - fReadPageRef.Get().GetClusterInfo().GetIndexOffset());
251 }
252
253 /// For offset columns only, look at the two adjacent values that define a collection's coordinates
254 void GetCollectionInfo(const ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart,
255 ROOT::NTupleSize_t *collectionSize)
256 {
257 ROOT::NTupleSize_t idxStart = 0;
258 ROOT::NTupleSize_t idxEnd;
259 // Try to avoid jumping back to the previous page and jumping back to the previous cluster
260 if (R__likely(globalIndex > 0)) {
261 if (R__likely(fReadPageRef.Get().Contains(globalIndex - 1))) {
262 idxStart = *Map<ROOT::Internal::RColumnIndex>(globalIndex - 1);
263 idxEnd = *Map<ROOT::Internal::RColumnIndex>(globalIndex);
264 if (R__unlikely(fReadPageRef.Get().GetClusterInfo().GetIndexOffset() == globalIndex))
265 idxStart = 0;
266 } else {
267 idxEnd = *Map<ROOT::Internal::RColumnIndex>(globalIndex);
268 auto selfOffset = fReadPageRef.Get().GetClusterInfo().GetIndexOffset();
269 idxStart = (globalIndex == selfOffset) ? 0 : *Map<ROOT::Internal::RColumnIndex>(globalIndex - 1);
270 }
271 } else {
272 idxEnd = *Map<ROOT::Internal::RColumnIndex>(globalIndex);
273 }
274 *collectionSize = idxEnd - idxStart;
275 *collectionStart = RNTupleLocalIndex(fReadPageRef.Get().GetClusterInfo().GetId(), idxStart);
276 }
277
278 void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart,
279 ROOT::NTupleSize_t *collectionSize)
280 {
281 auto index = localIndex.GetIndexInCluster();
282 auto idxStart = (index == 0) ? 0 : *Map<ROOT::Internal::RColumnIndex>(localIndex - 1);
283 auto idxEnd = *Map<ROOT::Internal::RColumnIndex>(localIndex);
284 *collectionSize = idxEnd - idxStart;
285 *collectionStart = RNTupleLocalIndex(localIndex.GetClusterId(), idxStart);
286 }
287
288 /// Get the currently active cluster id
289 void GetSwitchInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *varIndex, std::uint32_t *tag)
290 {
291 auto varSwitch = Map<ROOT::Internal::RColumnSwitch>(globalIndex);
292 *varIndex = RNTupleLocalIndex(fReadPageRef.Get().GetClusterInfo().GetId(), varSwitch->GetIndex());
293 *tag = varSwitch->GetTag();
294 }
295
296 void MapPage(ROOT::NTupleSize_t globalIndex) { R__ASSERT(TryMapPage(globalIndex)); }
297 void MapPage(RNTupleLocalIndex localIndex) { R__ASSERT(TryMapPage(localIndex)); }
298 bool TryMapPage(ROOT::NTupleSize_t globalIndex);
299 bool TryMapPage(RNTupleLocalIndex localIndex);
300
301 void MergeTeams(RReadColumn &other);
302
303 // Used only for testing
304 const RPageSource *GetPageSource() const { return fPageSource; }
305};
306
307class RWriteColumn : public RColumn {
308private:
310 /// The page into which new elements are being written. The page will initially be small
311 /// (RNTupleWriteOptions::fInitialUnzippedPageSize, which corresponds to fInitialElements) and expand as needed and
312 /// as memory for page buffers is still available (RNTupleWriteOptions::fPageBufferBudget) or the maximum page
313 /// size is reached (RNTupleWriteOptions::fMaxUnzippedPageSize).
315 /// The initial number of elements in a page
317 /// The number of elements written
319 /// Global index of the first element in this column; usually == 0, unless it is a deferred column
321
322 /// Used when trying to append to a full write page. If possible, expand the page. Otherwise, flush and reset
323 /// to the minimal size.
325 {
326 auto newMaxElements = fWritePage.GetMaxElements() * 2;
327 if (newMaxElements * fElement->GetSize() > fPageSink->GetWriteOptions().GetMaxUnzippedPageSize()) {
328 newMaxElements = fPageSink->GetWriteOptions().GetMaxUnzippedPageSize() / fElement->GetSize();
329 }
330
331 if (newMaxElements == fWritePage.GetMaxElements()) {
332 // Maximum page size reached, flush and reset
333 Flush();
334 } else {
335 auto expandedPage = fPageSink->ReservePage(*this, newMaxElements);
336 if (expandedPage.IsNull()) {
337 Flush();
338 } else {
339 memcpy(expandedPage.GetBuffer(), fWritePage.GetBuffer(), fWritePage.GetNBytes());
340 expandedPage.Reset(fNElements);
341 expandedPage.GrowUnchecked(fWritePage.GetNElements());
342 fWritePage = std::move(expandedPage);
343 }
344 }
345
347 }
348
349 RWriteColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
350 : RColumn(type, columnIndex, representationIndex)
351 {
352 }
353
354public:
355 template <typename CppT>
356 static std::unique_ptr<RWriteColumn>
357 Create(ROOT::ENTupleColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
358 {
359 auto column = std::unique_ptr<RWriteColumn>(new RWriteColumn(type, columnIdx, representationIdx));
360 column->fElement = ROOT::Internal::RColumnElementBase::Generate<CppT>(type);
361 return column;
362 }
363
364 ~RWriteColumn() = default;
365
366 /// Connect the column to a page sink. `firstElementIndex` can be used to specify the first column element index
367 /// with backing storage for this column. On read back, elements before `firstElementIndex` will cause the zero page
368 /// to be mapped.
370 ROOT::NTupleSize_t firstElementIndex = 0U);
371
372 void Append(const void *from)
373 {
376 }
377
378 void *dst = fWritePage.GrowUnchecked(1);
379
380 std::memcpy(dst, from, fElement->GetSize());
381 fNElements++;
382 }
383
384 void AppendV(const void *from, std::size_t count)
385 {
386 auto src = reinterpret_cast<const unsigned char *>(from);
387 while (count > 0) {
388 std::size_t nElementsRemaining = fWritePage.GetMaxElements() - fWritePage.GetNElements();
389 if (nElementsRemaining == 0) {
391 nElementsRemaining = fWritePage.GetMaxElements() - fWritePage.GetNElements();
392 }
393
394 assert(nElementsRemaining > 0);
395 auto nBatch = std::min(count, nElementsRemaining);
396
397 void *dst = fWritePage.GrowUnchecked(nBatch);
398 std::memcpy(dst, src, nBatch * fElement->GetSize());
399 src += nBatch * fElement->GetSize();
400 count -= nBatch;
401 fNElements += nBatch;
402 }
403 }
404
405 void Flush();
406 void CommitSuppressed();
407 std::size_t GetWritePageCapacity() const { return fWritePage.GetCapacity(); }
409};
410
412{
413 return static_cast<RReadColumn *>(this);
414}
415inline const RReadColumn *RColumn::ForReading() const
416{
417 return static_cast<const RReadColumn *>(this);
418}
420{
421 return static_cast<RWriteColumn *>(this);
422}
424{
425 return static_cast<const RWriteColumn *>(this);
426}
427
428} // namespace ROOT::Internal
429
430#endif
#define R__likely(expr)
Definition RConfig.hxx:569
#define R__unlikely(expr)
Definition RConfig.hxx:568
double * dst
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:139
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
The available trivial, native content types of a column.
A column element encapsulates the translation between basic C++ types and their column representation...
A column is a storage-backed array of a simple, fixed-size type, from which pages can be mapped into ...
Definition RColumn.hxx:40
RColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
Definition RColumn.hxx:53
std::optional< std::pair< double, double > > GetValueRange() const
Definition RColumn.hxx:81
RColumn & operator=(const RColumn &)=delete
std::uint16_t GetRepresentationIndex() const
Definition RColumn.hxx:87
RColumn(const RColumn &)=delete
std::uint16_t fRepresentationIndex
Fields can have multiple column representations, distinguished by representation index.
Definition RColumn.hxx:50
ROOT::Internal::RColumnElementBase * GetElement() const
Definition RColumn.hxx:74
void SetBitsOnStorage(std::size_t bits)
Definition RColumn.hxx:90
ROOT::ENTupleColumnType GetType() const
Definition RColumn.hxx:75
void SetValueRange(double min, double max)
Definition RColumn.hxx:91
ROOT::DescriptorId_t GetOnDiskId() const
Definition RColumn.hxx:88
RReadColumn * ForReading()
Definition RColumn.hxx:411
RWriteColumn * ForWriting()
Definition RColumn.hxx:419
ROOT::DescriptorId_t fOnDiskId
The column id in the column descriptor, once connected to a sink or source.
Definition RColumn.hxx:43
std::uint32_t fIndex
Columns belonging to the same field are distinguished by their order.
Definition RColumn.hxx:48
virtual ~RColumn()=default
std::uint16_t GetBitsOnStorage() const
Definition RColumn.hxx:76
std::uint32_t GetIndex() const
Definition RColumn.hxx:86
std::unique_ptr< ROOT::Internal::RColumnElementBase > fElement
Used to pack and unpack pages on writing/reading.
Definition RColumn.hxx:45
ROOT::ENTupleColumnType fType
Definition RColumn.hxx:51
Reference to a page stored in the page pool.
const RPage & Get() const
Abstract interface to write data into an ntuple.
const ROOT::RNTupleWriteOptions & GetWriteOptions() const
virtual ROOT::Internal::RPage ReservePage(RWriteColumn &column, std::size_t nElements)
Get a new, empty page for the given column that can be filled with up to nElements; nElements must be...
Abstract interface to read data from an ntuple.
ROOT::NTupleSize_t GetIndexOffset() const
Definition RPage.hxx:63
ROOT::DescriptorId_t GetId() const
Definition RPage.hxx:62
A page is a slice of a column that is mapped into memory.
Definition RPage.hxx:43
ROOT::NTupleSize_t GetGlobalRangeLast() const
Definition RPage.hxx:123
std::uint32_t GetNElements() const
Definition RPage.hxx:120
std::size_t GetNBytes() const
The space taken by column elements in the buffer.
Definition RPage.hxx:111
void * GrowUnchecked(std::uint32_t nElements)
Increases the number elements in the page.
Definition RPage.hxx:149
void * GetBuffer() const
Definition RPage.hxx:142
ROOT::NTupleSize_t GetLocalRangeLast() const
Definition RPage.hxx:125
std::uint32_t GetMaxElements() const
Definition RPage.hxx:121
std::size_t GetCapacity() const
Definition RPage.hxx:115
bool Contains(ROOT::NTupleSize_t globalIndex) const
Definition RPage.hxx:128
const RClusterInfo & GetClusterInfo() const
Definition RPage.hxx:126
ROOT::NTupleSize_t GetGlobalRangeFirst() const
Definition RPage.hxx:122
ROOT::NTupleSize_t GetLocalRangeFirst() const
Definition RPage.hxx:124
void MergeTeams(RReadColumn &other)
Definition RColumn.cxx:109
std::unique_ptr< RTeam > fTeam
As an optimization, if unset the team contains consists of this column only.
Definition RColumn.hxx:109
CppT * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
Definition RColumn.hxx:224
RReadColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
Definition RColumn.hxx:111
void GetSwitchInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *varIndex, std::uint32_t *tag)
Get the currently active cluster id.
Definition RColumn.hxx:289
ROOT::Internal::RPageSource * fPageSource
Definition RColumn.hxx:105
CppT * Map(const ROOT::NTupleSize_t globalIndex)
Definition RColumn.hxx:198
bool TryMapPage(ROOT::NTupleSize_t globalIndex)
Definition RColumn.cxx:67
void ConnectPageSource(ROOT::DescriptorId_t fieldId, ROOT::Internal::RPageSource &pageSource)
Connect the column to a page source.
Definition RColumn.cxx:55
void ReadV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t count, void *to)
Definition RColumn.hxx:153
void ReadV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t count, void *to)
Definition RColumn.hxx:175
const RPageSource * GetPageSource() const
Definition RColumn.hxx:304
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *collectionSize)
Definition RColumn.hxx:278
void GetCollectionInfo(const ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
Definition RColumn.hxx:254
void MapPage(RNTupleLocalIndex localIndex)
Definition RColumn.hxx:297
void Read(const ROOT::NTupleSize_t globalIndex, void *to)
Definition RColumn.hxx:131
ROOT::NTupleSize_t GetGlobalIndex(RNTupleLocalIndex clusterIndex)
Definition RColumn.hxx:236
static std::unique_ptr< RReadColumn > Create(ROOT::ENTupleColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
Definition RColumn.hxx:119
ROOT::Internal::RPageRef fReadPageRef
The currently mapped page for reading.
Definition RColumn.hxx:107
RNTupleLocalIndex GetClusterIndex(ROOT::NTupleSize_t globalIndex)
Definition RColumn.hxx:244
void MapPage(ROOT::NTupleSize_t globalIndex)
Definition RColumn.hxx:296
CppT * MapV(const ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
Definition RColumn.hxx:212
CppT * Map(RNTupleLocalIndex localIndex)
Definition RColumn.hxx:205
void Read(RNTupleLocalIndex localIndex, void *to)
Definition RColumn.hxx:142
ROOT::Internal::RPageSink * fPageSink
Definition RColumn.hxx:309
ROOT::NTupleSize_t fNElements
The number of elements written.
Definition RColumn.hxx:318
ROOT::Internal::RPage fWritePage
The page into which new elements are being written.
Definition RColumn.hxx:314
void HandleWritePageIfFull()
Used when trying to append to a full write page.
Definition RColumn.hxx:324
std::size_t GetWritePageCapacity() const
Definition RColumn.hxx:407
ROOT::NTupleSize_t GetFirstElementIndex() const
Definition RColumn.hxx:408
void AppendV(const void *from, std::size_t count)
Definition RColumn.hxx:384
RWriteColumn(ROOT::ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex)
Definition RColumn.hxx:349
ROOT::NTupleSize_t fFirstElementIndex
Global index of the first element in this column; usually == 0, unless it is a deferred column.
Definition RColumn.hxx:320
static std::unique_ptr< RWriteColumn > Create(ROOT::ENTupleColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
Definition RColumn.hxx:357
void ConnectPageSink(ROOT::DescriptorId_t fieldId, ROOT::Internal::RPageSink &pageSink, ROOT::NTupleSize_t firstElementIndex=0U)
Connect the column to a page sink.
Definition RColumn.cxx:23
void Append(const void *from)
Definition RColumn.hxx:372
ROOT::NTupleSize_t fInitialNElements
The initial number of elements in a page.
Definition RColumn.hxx:316
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
ROOT::NTupleSize_t GetIndexInCluster() const
ROOT::DescriptorId_t GetClusterId() const
std::size_t GetMaxUnzippedPageSize() const
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
The column team is a set of columns that serve the same column index for different representation IDs...
Definition RColumn.hxx:100
std::vector< RReadColumn * > fMembers
Definition RColumn.hxx:101