Logo ROOT   6.18/05
Reference Guide
RColumnModel.hxx
Go to the documentation of this file.
1/// \file ROOT/RColumnModel.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-09
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#ifndef ROOT7_RColumnModel
17#define ROOT7_RColumnModel
18
19#include <ROOT/RStringView.hxx>
20
21#include <string>
22
23namespace ROOT {
24namespace Experimental {
25
26namespace Detail {
27class RColumnElementBase;
28}
29
30// clang-format off
31/**
32\class ROOT::Experimental::EColumnType
33\ingroup NTuple
34\brief The available trivial, native content types of a column
35
36More complex types, such as classes, get translated into columns of such simple types by the RField.
37*/
38// clang-format on
39enum class EColumnType {
40 kUnknown = 0,
41 // type for root columns of (nested) collections; 32bit integers that count
42 // relative to the current cluster
43 kIndex,
44 kByte,
45 kReal64,
46 kReal32,
47 kReal16,
48 kReal8,
49 kInt64,
50 kInt32,
51 kInt16,
52 //...
53};
54
55/**
56 * Lookup table for the element size in bytes for column types. The array has to correspond to EColumnTypes.
57 */
58constexpr std::size_t kColumnElementSizes[] =
59 {0 /* kUnknown */, 4 /* kIndex */, 1 /* kByte */, 8 /* kReal64 */, 4 /* kReal32 */, 2 /* kReal16 */,
60 1 /* kReal8 */, 8 /* kInt64 */, 4 /* kInt32 */, 2 /* kInt16 */};
61
62// clang-format off
63/**
64\class ROOT::Experimental::RColumnModel
65\ingroup NTuple
66\brief Holds the static meta-data of a column in a tree
67*/
68// clang-format on
70private:
71 std::string fName;
74
75public:
78 : fName(name), fType(type), fIsSorted(isSorted) {}
79
80 std::size_t GetElementSize() const { return kColumnElementSizes[static_cast<int>(fType)]; }
81 std::string GetName() const { return fName; }
82 EColumnType GetType() const { return fType; }
83 bool GetIsSorted() const { return fIsSorted; }
84
86 bool operator ==(const RColumnModel &other) const {
87 return (fName == other.fName) && (fType == other.fType) && (fIsSorted == other.fIsSorted);
88 }
89};
90
91} // namespace Experimental
92} // namespace ROOT
93
94#endif
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
@ kUnknown
Definition: TStructNode.h:19
Holds the static meta-data of a column in a tree.
std::size_t GetElementSize() const
Detail::RColumnElementBase * GenerateElement()
RColumnModel(std::string_view name, EColumnType type, bool isSorted)
bool operator==(const RColumnModel &other) const
basic_string_view< char > string_view
constexpr std::size_t kColumnElementSizes[]
Lookup table for the element size in bytes for column types.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21