Logo ROOT  
Reference Guide
RColumn.cxx
Go to the documentation of this file.
1/// \file RColumn.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-04
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#include <ROOT/RColumn.hxx>
17#include <ROOT/RColumnModel.hxx>
18#include <ROOT/RPageStorage.hxx>
19
20#include <TError.h>
21
22#include <iostream>
23
25 : fModel(model), fIndex(index), fPageSink(nullptr), fPageSource(nullptr), fHeadPage(), fNElements(0),
26 fCurrentPage(),
27 fColumnIdSource(kInvalidColumnId)
28{
29}
30
32{
33 if (!fHeadPage.IsNull())
34 fPageSink->ReleasePage(fHeadPage);
35 if (!fCurrentPage.IsNull())
36 fPageSource->ReleasePage(fCurrentPage);
37}
38
40{
41 switch (pageStorage->GetType()) {
43 fPageSink = static_cast<RPageSink*>(pageStorage); // the page sink initializes fHeadPage on AddColumn
44 fHandleSink = fPageSink->AddColumn(fieldId, *this);
45 fHeadPage = fPageSink->ReservePage(fHandleSink);
46 break;
48 fPageSource = static_cast<RPageSource*>(pageStorage);
49 fHandleSource = fPageSource->AddColumn(fieldId, *this);
50 fNElements = fPageSource->GetNElements(fHandleSource);
51 fColumnIdSource = fPageSource->GetColumnId(fHandleSource);
52 break;
53 default:
54 R__ASSERT(false);
55 }
56}
57
59{
60 if (fHeadPage.GetSize() == 0) return;
61
62 fPageSink->CommitPage(fHandleSink, fHeadPage);
63 fHeadPage.Reset(fNElements);
64}
65
67{
68 fPageSource->ReleasePage(fCurrentPage);
69 fCurrentPage = fPageSource->PopulatePage(fHandleSource, index);
70}
71
73{
74 fPageSource->ReleasePage(fCurrentPage);
75 fCurrentPage = fPageSource->PopulatePage(fHandleSource, clusterIndex);
76}
#define R__ASSERT(e)
Definition: TError.h:96
void Connect(DescriptorId_t fieldId, RPageStorage *pageStorage)
Definition: RColumn.cxx:39
void MapPage(const NTupleSize_t index)
Definition: RColumn.cxx:66
RColumn(const RColumnModel &model, std::uint32_t index)
Definition: RColumn.cxx:24
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) final
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...
Definition: RNTupleUtil.hxx:83
Holds the static meta-data of a column in a tree.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Definition: RNTupleUtil.hxx:43
constexpr ColumnId_t kInvalidColumnId
Definition: RNTupleUtil.hxx:76
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
Definition: RNTupleUtil.hxx:79