93 if (expandedPage.IsNull()) {
107 template <
typename CppT>
110 auto column = std::unique_ptr<RColumn>(
new RColumn(
type, columnIdx, representationIdx));
111 column->fElement = RColumnElementBase::Generate<CppT>(
type);
134 std::memcpy(dst, from,
fElement->GetSize());
138 void AppendV(
const void *from, std::size_t count)
140 auto src =
reinterpret_cast<const unsigned char *
>(from);
144 if (nElementsRemaining == 0) {
149 assert(nElementsRemaining > 0);
150 auto nBatch = std::min(count, nElementsRemaining);
153 std::memcpy(dst,
src, nBatch *
fElement->GetSize());
165 const auto elemSize =
fElement->GetSize();
168 std::memcpy(to, from, elemSize);
176 const auto elemSize =
fElement->GetSize();
179 std::memcpy(to, from, elemSize);
189 const auto elemSize =
fElement->GetSize();
192 std::memcpy(to, from, elemSize * count);
195 std::memcpy(to, from, elemSize * nBatch);
196 auto tail =
static_cast<unsigned char *
>(to) + nBatch * elemSize;
197 ReadV(globalIndex + nBatch, count - nBatch, tail);
208 const auto elemSize =
fElement->GetSize();
211 std::memcpy(to, from, elemSize * count);
214 std::memcpy(to, from, elemSize * nBatch);
215 auto tail =
static_cast<unsigned char *
>(to) + nBatch * elemSize;
220 template <
typename CppT>
224 return MapV<CppT>(globalIndex, nItems);
227 template <
typename CppT>
231 return MapV<CppT>(clusterIndex, nItems);
234 template <
typename CppT>
246 template <
typename CppT>
284 idxStart = *Map<ClusterSize_t>(globalIndex - 1);
285 idxEnd = *Map<ClusterSize_t>(globalIndex);
289 idxEnd = *Map<ClusterSize_t>(globalIndex);
291 idxStart = (globalIndex == selfOffset) ? 0 : *Map<ClusterSize_t>(globalIndex - 1);
294 idxEnd = *Map<ClusterSize_t>(globalIndex);
296 *collectionSize = idxEnd - idxStart;
303 auto idxStart = (
index == 0) ? 0 : *Map<ClusterSize_t>(clusterIndex - 1);
304 auto idxEnd = *Map<ClusterSize_t>(clusterIndex);
305 *collectionSize = idxEnd - idxStart;
312 auto varSwitch = Map<RColumnSwitch>(globalIndex);
314 *tag = varSwitch->GetTag();
336 return fElement->GetBitsOnStorage();
#define R__unlikely(expr)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
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
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 ...
RColumn(const RColumn &)=delete
std::size_t fLastGoodTeamIdx
Points into fTeam to the column that successfully returned the last page.
RPageStorage::ColumnHandle_t GetHandleSink() const
void Read(RClusterIndex clusterIndex, void *to)
void ConnectPageSink(DescriptorId_t fieldId, RPageSink &pageSink, NTupleSize_t firstElementIndex=0U)
Connect the column to a page sink.
std::unique_ptr< RColumnElementBase > fElement
Used to pack and unpack pages on writing/reading.
void HandleWritePageIfFull()
Used when trying to append to a full write page.
NTupleSize_t GetGlobalIndex(RClusterIndex clusterIndex)
RColumnElementBase * GetElement() const
RPageRef fReadPageRef
The currently mapped page for reading.
bool TryMapPage(NTupleSize_t globalIndex)
void SetBitsOnStorage(std::size_t bits)
void MapPage(RClusterIndex clusterIndex)
DescriptorId_t GetOnDiskId() const
void MapPage(NTupleSize_t globalIndex)
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
void ReadV(RClusterIndex clusterIndex, const ClusterSize_t::ValueType count, void *to)
CppT * Map(const NTupleSize_t globalIndex)
RPageSource * GetPageSource() const
RPageSource * fPageSource
static std::unique_ptr< RColumn > Create(EColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
void AppendV(const void *from, std::size_t count)
std::optional< std::pair< double, double > > GetValueRange() const
void Append(const void *from)
CppT * Map(RClusterIndex clusterIndex)
CppT * MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems)
RColumn & operator=(const RColumn &)=delete
bool ReadPageContains(RClusterIndex clusterIndex) const
RPageStorage::ColumnHandle_t fHandleSource
NTupleSize_t fNElements
The number of elements written resp. available in the column.
std::uint16_t GetRepresentationIndex() const
void ReadV(const NTupleSize_t globalIndex, const ClusterSize_t::ValueType count, void *to)
std::vector< RColumn * > fTeam
The column team is a set of columns that serve the same column index for different representation IDs...
void Read(const NTupleSize_t globalIndex, void *to)
EColumnType GetType() const
std::uint32_t fIndex
Columns belonging to the same field are distinguished by their order.
std::uint32_t GetIndex() const
std::size_t GetWritePageCapacity() const
void ConnectPageSource(DescriptorId_t fieldId, RPageSource &pageSource)
Connect the column to a page source.
RPageSink * GetPageSink() const
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.
CppT * MapV(const NTupleSize_t globalIndex, NTupleSize_t &nItems)
void MergeTeams(RColumn &other)
std::uint16_t fRepresentationIndex
Fields can have multiple column representations, distinguished by representation index.
void GetSwitchInfo(NTupleSize_t globalIndex, RClusterIndex *varIndex, std::uint32_t *tag)
Get the currently active cluster id.
RPageStorage::ColumnHandle_t fHandleSink
void SetValueRange(double min, double max)
NTupleSize_t fInitialNElements
The initial number of elements in a page.
DescriptorId_t fOnDiskId
The column id in the column descriptor, once connected to a sink or source.
NTupleSize_t GetNElements() const
RPage fWritePage
The page into which new elements are being written.
bool ReadPageContains(NTupleSize_t globalIndex) const
NTupleSize_t GetFirstElementIndex() const
RPageStorage::ColumnHandle_t GetHandleSource() const
RClusterIndex GetClusterIndex(NTupleSize_t globalIndex)
NTupleSize_t fFirstElementIndex
Global index of the first element in this column; usually == 0, unless it is a deferred column.
std::uint16_t GetBitsOnStorage() const
Abstract interface to write data into an ntuple.
virtual RPage ReservePage(ColumnHandle_t columnHandle, std::size_t nElements)
Get a new, empty page for the given column that can be filled with up to nElements; nElements must be...
const RNTupleWriteOptions & GetWriteOptions() const
Returns the sink's write options.
Abstract interface to read data from an ntuple.
NTupleSize_t GetIndexOffset() const
NTupleSize_t GetId() const
A page is a slice of a column that is mapped into memory.
void * GrowUnchecked(ClusterSize_t::ValueType nElements)
Increases the number elements in the page.
std::size_t GetCapacity() const
ClusterSize_t::ValueType GetClusterRangeFirst() const
std::size_t GetNBytes() const
The space taken by column elements in the buffer.
NTupleSize_t GetGlobalRangeFirst() const
const RClusterInfo & GetClusterInfo() const
std::uint32_t GetNElements() const
bool Contains(NTupleSize_t globalIndex) const
ClusterSize_t::ValueType GetClusterRangeLast() const
NTupleSize_t GetGlobalRangeLast() const
std::uint32_t GetMaxElements() 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
std::size_t GetMaxUnzippedPageSize() const
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.
constexpr DescriptorId_t kInvalidDescriptorId
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.