33namespace Experimental {
103 template <
typename CppT>
106 auto column = std::unique_ptr<RColumn>(
new RColumn(model,
index));
107 column->fElement = RColumnElementBase::Generate<CppT>(model.
GetType());
129 std::memcpy(dst, from,
fElement->GetSize());
135 void AppendV(
const void *from, std::size_t count)
140 for (
unsigned i = 0; i < count; ++i) {
141 Append(
static_cast<const unsigned char *
>(from) +
fElement->GetSize() * i);
159 std::memcpy(dst, from,
fElement->GetSize() * count);
171 const auto elemSize =
fElement->GetSize();
174 std::memcpy(to, from, elemSize);
182 const auto elemSize =
fElement->GetSize();
185 std::memcpy(to, from, elemSize);
195 const auto elemSize =
fElement->GetSize();
196 const void *from =
static_cast<unsigned char *
>(
fReadPage.
GetBuffer()) + idxInPage * elemSize;
198 std::memcpy(to, from, elemSize * count);
201 std::memcpy(to, from, elemSize * nBatch);
202 auto tail =
static_cast<unsigned char *
>(to) + nBatch * elemSize;
203 ReadV(globalIndex + nBatch, count - nBatch, tail);
214 const auto elemSize =
fElement->GetSize();
215 const void *from =
static_cast<unsigned char *
>(
fReadPage.
GetBuffer()) + idxInPage * elemSize;
217 std::memcpy(to, from, elemSize * count);
220 std::memcpy(to, from, elemSize * nBatch);
221 auto tail =
static_cast<unsigned char *
>(to) + nBatch * elemSize;
226 template <
typename CppT>
229 return MapV<CppT>(globalIndex, nItems);
232 template <
typename CppT>
235 return MapV<CppT>(clusterIndex, nItems);
238 template <
typename CppT>
245 return reinterpret_cast<CppT*
>(
250 template <
typename CppT>
257 return reinterpret_cast<CppT*
>(
285 idxStart = *Map<ClusterSize_t>(globalIndex - 1);
286 idxEnd = *Map<ClusterSize_t>(globalIndex);
290 idxEnd = *Map<ClusterSize_t>(globalIndex);
292 idxStart = (globalIndex == selfOffset) ? 0 : *Map<ClusterSize_t>(globalIndex - 1);
295 idxEnd = *Map<ClusterSize_t>(globalIndex);
297 *collectionSize = idxEnd - idxStart;
305 auto idxStart = (
index == 0) ? 0 : *Map<ClusterSize_t>(clusterIndex - 1);
306 auto idxEnd = *Map<ClusterSize_t>(clusterIndex);
307 *collectionSize = idxEnd - idxStart;
313 auto varSwitch = Map<RColumnSwitch>(globalIndex);
315 *tag = varSwitch->GetTag();
#define R__unlikely(expr)
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
A column element encapsulates the translation between basic C++ types and their column representation...
RPageStorage::ColumnHandle_t GetHandleSource() const
void AppendV(const void *from, std::size_t count)
RColumn & operator=(const RColumn &)=delete
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
const RColumnModel & GetModel() const
void ReadV(const NTupleSize_t globalIndex, const ClusterSize_t::ValueType count, void *to)
ColumnId_t GetColumnIdSource() const
void Append(const void *from)
RPageSink * GetPageSink() const
std::uint32_t GetIndex() const
RPage fReadPage
The currently mapped page for reading.
CppT * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
RPageSource * fPageSource
RColumnElementBase * GetElement() const
void Connect(DescriptorId_t fieldId, RPageStorage *pageStorage, NTupleSize_t firstElementIndex=0U)
Connect the column to a page storage.
void Read(const RClusterIndex &clusterIndex, void *to)
CppT * MapV(const NTupleSize_t globalIndex, NTupleSize_t &nItems)
void FlushShadowWritePage()
When the main write page surpasses the 50% fill level, the (full) shadow write page gets flushed.
void MapPage(const NTupleSize_t index)
NTupleSize_t GetFirstElementIndex() const
void SwapWritePagesIfFull()
Used in Append() and AppendV() to switch pages when the main page reached the target size The other p...
void GetSwitchInfo(NTupleSize_t globalIndex, RClusterIndex *varIndex, std::uint32_t *tag)
Get the currently active cluster id.
CppT * Map(const NTupleSize_t globalIndex)
std::uint32_t fApproxNElementsPerPage
For writing, the targeted number of elements, given by fApproxNElementsPerPage (in the write options)...
void Read(const NTupleSize_t globalIndex, void *to)
CppT * Map(const RClusterIndex &clusterIndex)
NTupleSize_t GetGlobalIndex(const RClusterIndex &clusterIndex)
std::unique_ptr< RColumnElementBase > fElement
Used to pack and unpack pages on writing/reading.
int fWritePageIdx
Index of the current write page.
NTupleSize_t GetNElements() const
RColumn(const RColumn &)=delete
std::uint32_t fIndex
Columns belonging to the same field are distinguished by their order.
static std::unique_ptr< RColumn > Create(const RColumnModel &model, std::uint32_t index)
RPageStorage::ColumnHandle_t GetHandleSink() const
NTupleSize_t fFirstElementIndex
Global index of the first element in this column; usually == 0, unless it is a deferred column.
void ReadV(const RClusterIndex &clusterIndex, const ClusterSize_t::ValueType count, void *to)
RPageSource * GetPageSource() const
NTupleSize_t fNElements
The number of elements written resp. available in the column.
ColumnId_t fColumnIdSource
The column id is used to find matching pages with content when reading.
RPageStorage::ColumnHandle_t fHandleSink
RPageStorage::ColumnHandle_t fHandleSource
void GetCollectionInfo(const NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
RClusterIndex GetClusterIndex(NTupleSize_t globalIndex)
RPage fWritePage[2]
A set of open pages into which new elements are being written.
Abstract interface to write data into an ntuple.
void CommitPage(ColumnHandle_t columnHandle, const RPage &page)
Write a page to the storage. The column must have been added before.
Abstract interface to read data from an ntuple.
Common functionality of an ntuple storage for both reading and writing.
NTupleSize_t GetIndexOffset() const
NTupleSize_t GetId() const
A page is a slice of a column that is mapped into memory.
ClusterSize_t::ValueType GetClusterRangeLast() const
bool Contains(NTupleSize_t globalIndex) const
void * GrowUnchecked(ClusterSize_t::ValueType nElements)
Called during writing: returns a pointer after the last element and increases the element counter in ...
const RClusterInfo & GetClusterInfo() const
std::uint32_t GetNElements() const
void Reset(NTupleSize_t rangeFirst)
Forget all currently stored elements (size == 0) and set a new starting index.
NTupleSize_t GetGlobalRangeFirst() const
NTupleSize_t GetGlobalRangeLast() const
ClusterSize_t::ValueType GetClusterRangeFirst() const
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
DescriptorId_t GetClusterId() const
ClusterSize_t::ValueType GetIndex() const
Holds the static meta-data of an RNTuple column.
EColumnType GetType() const
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr ColumnId_t kInvalidColumnId
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::int64_t ColumnId_t
Uniquely identifies a physical column within the scope of the current process, used to tag pages.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Wrap the integer in a struct in order to avoid template specialization clash with std::uint32_t.