Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:22:26

0001 /// \file ROOT/RColumnModel.hxx
0002 /// \ingroup NTuple ROOT7
0003 /// \author Jakob Blomer <jblomer@cern.ch>
0004 /// \date 2018-10-09
0005 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
0006 /// is welcome!
0007 
0008 /*************************************************************************
0009  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0010  * All rights reserved.                                                  *
0011  *                                                                       *
0012  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0013  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0014  *************************************************************************/
0015 
0016 #ifndef ROOT7_RColumnModel
0017 #define ROOT7_RColumnModel
0018 
0019 #include <string_view>
0020 
0021 #include <string>
0022 
0023 namespace ROOT {
0024 namespace Experimental {
0025 
0026 // clang-format off
0027 /**
0028 \class ROOT::Experimental::EColumnType
0029 \ingroup NTuple
0030 \brief The available trivial, native content types of a column
0031 
0032 More complex types, such as classes, get translated into columns of such simple types by the RField.
0033 New types need to be accounted for in RColumnElementBase::Generate() and RColumnElementBase::GetBitsOnStorage(), too.
0034 When changed, remember to update
0035   - RColumnElement::Generate()
0036   - RColumnElement::GetBitsOnStorage()
0037   - RColumnElement::GetTypeName()
0038   - RColumnElement template specializations / packing & unpacking
0039   - If necessary, endianess handling for the packing + unit test in ntuple_endian
0040   - RNTupleSerializer::[Des|S]erializeColumnType
0041 */
0042 // clang-format on
0043 enum class EColumnType {
0044    kUnknown = 0,
0045    // type for root columns of (nested) collections; offsets are relative to the current cluster
0046    kIndex64,
0047    kIndex32,
0048    // 96 bit column that is a pair of a kIndex64 and a 32bit dispatch tag to a column ID;
0049    // used to serialize std::variant.
0050    kSwitch,
0051    kByte,
0052    kChar,
0053    kBit,
0054    kReal64,
0055    kReal32,
0056    kReal16,
0057    kInt64,
0058    kUInt64,
0059    kInt32,
0060    kUInt32,
0061    kInt16,
0062    kUInt16,
0063    kInt8,
0064    kUInt8,
0065    kSplitIndex64,
0066    kSplitIndex32,
0067    kSplitReal64,
0068    kSplitReal32,
0069    kSplitInt64,
0070    kSplitUInt64,
0071    kSplitInt32,
0072    kSplitUInt32,
0073    kSplitInt16,
0074    kSplitUInt16,
0075    kMax,
0076 };
0077 
0078 // clang-format off
0079 /**
0080 \class ROOT::Experimental::RColumnModel
0081 \ingroup NTuple
0082 \brief Holds the static meta-data of an RNTuple column
0083 */
0084 // clang-format on
0085 class RColumnModel {
0086 private:
0087    EColumnType fType;
0088    bool fIsSorted;
0089 
0090 public:
0091    RColumnModel() : fType(EColumnType::kUnknown), fIsSorted(false) {}
0092    explicit RColumnModel(EColumnType type)
0093       : fType(type), fIsSorted(type == EColumnType::kIndex32 || type == EColumnType::kSplitIndex32)
0094    {
0095    }
0096    RColumnModel(EColumnType type, bool isSorted) : fType(type), fIsSorted(isSorted) {}
0097 
0098    EColumnType GetType() const { return fType; }
0099    bool GetIsSorted() const { return fIsSorted; }
0100 
0101    bool operator ==(const RColumnModel &other) const {
0102       return (fType == other.fType) && (fIsSorted == other.fIsSorted);
0103    }
0104    bool operator!=(const RColumnModel &other) const { return !(other == *this); }
0105 };
0106 
0107 } // namespace Experimental
0108 } // namespace ROOT
0109 
0110 #endif