Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 if (fHandleSink)
38 fPageSink->DropColumn(fHandleSink);
39 if (fHandleSource)
40 fPageSource->DropColumn(fHandleSource);
41}
42
44{
45 switch (pageStorage->GetType()) {
47 fPageSink = static_cast<RPageSink*>(pageStorage); // the page sink initializes fHeadPage on AddColumn
48 fHandleSink = fPageSink->AddColumn(fieldId, *this);
49 fHeadPage = fPageSink->ReservePage(fHandleSink);
50 break;
52 fPageSource = static_cast<RPageSource*>(pageStorage);
53 fHandleSource = fPageSource->AddColumn(fieldId, *this);
54 fNElements = fPageSource->GetNElements(fHandleSource);
55 fColumnIdSource = fPageSource->GetColumnId(fHandleSource);
56 break;
57 default:
58 R__ASSERT(false);
59 }
60}
61
63{
64 if (fHeadPage.GetSize() == 0) return;
65
66 fPageSink->CommitPage(fHandleSink, fHeadPage);
67 fHeadPage.Reset(fNElements);
68}
69
71{
72 fPageSource->ReleasePage(fCurrentPage);
73 fCurrentPage = fPageSource->PopulatePage(fHandleSource, index);
74}
75
77{
78 fPageSource->ReleasePage(fCurrentPage);
79 fCurrentPage = fPageSource->PopulatePage(fHandleSource, clusterIndex);
80}
#define R__ASSERT(e)
Definition TError.h:120
void Connect(DescriptorId_t fieldId, RPageStorage *pageStorage)
Definition RColumn.cxx:43
void MapPage(const NTupleSize_t index)
Definition RColumn.cxx:70
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...
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.
constexpr ColumnId_t kInvalidColumnId
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.