Logo ROOT  
Reference Guide
RNTupleUtil.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleUtil.hxx
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-2020, 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#ifndef ROOT7_RNTupleUtil
17#define ROOT7_RNTupleUtil
18
19#include <cstdint>
20
21#include <string>
22
23#include <ROOT/RLogger.hxx>
24
25namespace ROOT {
26namespace Experimental {
27
28class RLogChannel;
29/// Log channel for RNTuple diagnostics.
30RLogChannel &NTupleLog();
31
32/**
33 * The fields in the ntuple model tree can carry different structural information about the type system.
34 * Leaf fields contain just data, collection fields resolve to offset columns, record fields have no
35 * materialization on the primitive column layer.
36 */
42 kReference, // unimplemented so far
44};
45
46/// Integer type long enough to hold the maximum number of entries in a column
47using NTupleSize_t = std::uint64_t;
48constexpr NTupleSize_t kInvalidNTupleIndex = std::uint64_t(-1);
49/// Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t
51 using ValueType = std::uint32_t;
52
54 explicit constexpr RClusterSize(ValueType value) : fValue(value) {}
55 RClusterSize& operator =(const ValueType value) { fValue = value; return *this; }
56 RClusterSize& operator +=(const ValueType value) { fValue += value; return *this; }
57 RClusterSize operator++(int) { auto result = *this; fValue++; return result; }
58 operator ValueType() const { return fValue; }
59
61};
63constexpr ClusterSize_t kInvalidClusterIndex(std::uint32_t(-1));
64
65/// Holds the index and the tag of a kSwitch column
67private:
69 std::uint32_t fTag = 0;
70
71public:
72 RColumnSwitch() = default;
73 RColumnSwitch(ClusterSize_t index, std::uint32_t tag) : fIndex(index), fTag(tag) { }
74 ClusterSize_t GetIndex() const { return fIndex; }
75 std::uint32_t GetTag() const { return fTag; }
76};
77
78/// Uniquely identifies a physical column within the scope of the current process, used to tag pages
79using ColumnId_t = std::int64_t;
81
82/// Distriniguishes elements of the same type within a descriptor, e.g. different fields
83using DescriptorId_t = std::uint64_t;
84constexpr DescriptorId_t kInvalidDescriptorId = std::uint64_t(-1);
85
86/// Addresses a column element or field item relative to a particular cluster, instead of a global NTupleSize_t index
88private:
91public:
92 RClusterIndex() = default;
93 RClusterIndex(const RClusterIndex &other) = default;
94 RClusterIndex &operator =(const RClusterIndex &other) = default;
96 : fClusterId(clusterId), fIndex(index) {}
97
100 RClusterIndex operator++(int) /* postfix */ { auto r = *this; fIndex++; return r; }
101 RClusterIndex& operator++() /* prefix */ { ++fIndex; return *this; }
102 bool operator==(const RClusterIndex &other) const {
103 return fClusterId == other.fClusterId && fIndex == other.fIndex;
104 }
105 bool operator!=(const RClusterIndex &other) const { return !(*this == other); }
106
109};
110
111/// Generic information about the physical location of data. Values depend on the concrete storage type. E.g.,
112/// for a local file fUrl might be unsused and fPosition might be a file offset. Objects on storage can be compressed
113/// and therefore we need to store their actual size.
114/// TODO(jblomer): should move the RNTUpleDescriptor and should be an std::variant
116 std::int64_t fPosition = 0;
117 std::uint32_t fBytesOnStorage = 0;
118 std::string fUrl;
119
120 bool operator==(const RNTupleLocator &other) const {
121 return fPosition == other.fPosition && fBytesOnStorage == other.fBytesOnStorage && fUrl == other.fUrl;
122 }
123};
124
125} // namespace Experimental
126} // namespace ROOT
127
128#endif
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 r
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 result
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 value
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Definition: RNTupleUtil.hxx:87
RClusterIndex operator+(ClusterSize_t::ValueType off) const
Definition: RNTupleUtil.hxx:98
bool operator==(const RClusterIndex &other) const
bool operator!=(const RClusterIndex &other) const
ClusterSize_t::ValueType fIndex
Definition: RNTupleUtil.hxx:90
RClusterIndex operator-(ClusterSize_t::ValueType off) const
Definition: RNTupleUtil.hxx:99
RClusterIndex & operator=(const RClusterIndex &other)=default
DescriptorId_t GetClusterId() const
constexpr RClusterIndex(DescriptorId_t clusterId, ClusterSize_t::ValueType index)
Definition: RNTupleUtil.hxx:95
ClusterSize_t::ValueType GetIndex() const
RClusterIndex(const RClusterIndex &other)=default
Holds the index and the tag of a kSwitch column.
Definition: RNTupleUtil.hxx:66
ClusterSize_t GetIndex() const
Definition: RNTupleUtil.hxx:74
std::uint32_t GetTag() const
Definition: RNTupleUtil.hxx:75
RColumnSwitch(ClusterSize_t index, std::uint32_t tag)
Definition: RNTupleUtil.hxx:73
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
Definition: RNTupleUtil.cxx:24
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Definition: RNTupleUtil.hxx:47
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
Definition: RNTupleUtil.hxx:37
constexpr ColumnId_t kInvalidColumnId
Definition: RNTupleUtil.hxx:80
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
Definition: RNTupleUtil.hxx:83
constexpr NTupleSize_t kInvalidNTupleIndex
Definition: RNTupleUtil.hxx:48
std::int64_t ColumnId_t
Uniquely identifies a physical column within the scope of the current process, used to tag pages.
Definition: RNTupleUtil.hxx:79
constexpr ClusterSize_t kInvalidClusterIndex(std::uint32_t(-1))
constexpr DescriptorId_t kInvalidDescriptorId
Definition: RNTupleUtil.hxx:84
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...
Definition: RNTupleUtil.hxx:50
RClusterSize & operator=(const ValueType value)
Definition: RNTupleUtil.hxx:55
constexpr RClusterSize(ValueType value)
Definition: RNTupleUtil.hxx:54
RClusterSize & operator+=(const ValueType value)
Definition: RNTupleUtil.hxx:56
Generic information about the physical location of data.
bool operator==(const RNTupleLocator &other) const