Skip to content

Commit 9304501

Browse files
committed
[ntuple] EColumnType --> ENTupleColumnType
1 parent 9609a42 commit 9304501

38 files changed

+1096
-1035
lines changed

tree/dataframe/src/RNTupleDS.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ class RRDFCardinalityField final : public ROOT::Experimental::RFieldBase {
7979

8080
const RColumnRepresentations &GetColumnRepresentations() const final
8181
{
82-
static RColumnRepresentations representations(
83-
{{EColumnType::kSplitIndex64}, {EColumnType::kIndex64}, {EColumnType::kSplitIndex32}, {EColumnType::kIndex32}},
84-
{});
82+
static RColumnRepresentations representations({{ENTupleColumnType::kSplitIndex64},
83+
{ENTupleColumnType::kIndex64},
84+
{ENTupleColumnType::kSplitIndex32},
85+
{ENTupleColumnType::kIndex32}},
86+
{});
8587
return representations;
8688
}
8789
// Field is only used for reading

tree/ntuple/v7/inc/ROOT/RColumn.hxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace ROOT::Experimental::Internal {
3939
// clang-format on
4040
class RColumn {
4141
private:
42-
EColumnType fType;
42+
ENTupleColumnType fType;
4343
/// Columns belonging to the same field are distinguished by their order. E.g. for an std::string field, there is
4444
/// the offset column with index 0 and the character value column with index 1.
4545
std::uint32_t fIndex;
@@ -74,7 +74,7 @@ private:
7474
/// Points into fTeam to the column that successfully returned the last page.
7575
std::size_t fLastGoodTeamIdx = 0;
7676

77-
RColumn(EColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex);
77+
RColumn(ENTupleColumnType type, std::uint32_t columnIndex, std::uint16_t representationIndex);
7878

7979
/// Used when trying to append to a full write page. If possible, expand the page. Otherwise, flush and reset
8080
/// to the minimal size.
@@ -105,7 +105,8 @@ private:
105105

106106
public:
107107
template <typename CppT>
108-
static std::unique_ptr<RColumn> Create(EColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
108+
static std::unique_ptr<RColumn>
109+
Create(ENTupleColumnType type, std::uint32_t columnIdx, std::uint16_t representationIdx)
109110
{
110111
auto column = std::unique_ptr<RColumn>(new RColumn(type, columnIdx, representationIdx));
111112
column->fElement = RColumnElementBase::Generate<CppT>(type);
@@ -337,7 +338,7 @@ public:
337338

338339
NTupleSize_t GetNElements() const { return fNElements; }
339340
RColumnElementBase *GetElement() const { return fElement.get(); }
340-
EColumnType GetType() const { return fType; }
341+
ENTupleColumnType GetType() const { return fType; }
341342
std::uint16_t GetBitsOnStorage() const
342343
{
343344
assert(fElement);

tree/ntuple/v7/inc/ROOT/RColumnElementBase.hxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public:
6969
/// in-memory C++ type, given by a type index.
7070
struct RIdentifier {
7171
std::type_index fInMemoryType = std::type_index(typeid(void));
72-
EColumnType fOnDiskType = EColumnType::kUnknown;
72+
ENTupleColumnType fOnDiskType = ENTupleColumnType::kUnknown;
7373

7474
bool operator==(const RIdentifier &other) const
7575
{
@@ -87,12 +87,12 @@ public:
8787

8888
/// If CppT == void, use the default C++ type for the given column type
8989
template <typename CppT = void>
90-
static std::unique_ptr<RColumnElementBase> Generate(EColumnType type);
91-
static const char *GetColumnTypeName(EColumnType type);
90+
static std::unique_ptr<RColumnElementBase> Generate(ENTupleColumnType type);
91+
static const char *GetColumnTypeName(ENTupleColumnType type);
9292
/// Most types have a fixed on-disk bit width. Some low-precision column types
9393
/// have a range of possible bit widths. Return the minimum and maximum allowed
9494
/// bit size per type.
95-
static std::pair<std::uint16_t, std::uint16_t> GetValidBitRange(EColumnType type);
95+
static std::pair<std::uint16_t, std::uint16_t> GetValidBitRange(ENTupleColumnType type);
9696

9797
/// Derived, typed classes tell whether the on-storage layout is bitwise identical to the memory layout
9898
virtual bool IsMappable() const
@@ -136,18 +136,18 @@ struct RTestFutureColumn {
136136
std::uint32_t dummy;
137137
};
138138

139-
std::unique_ptr<RColumnElementBase> GenerateColumnElement(std::type_index inMemoryType, EColumnType onDiskType);
139+
std::unique_ptr<RColumnElementBase> GenerateColumnElement(std::type_index inMemoryType, ENTupleColumnType onDiskType);
140140

141141
std::unique_ptr<RColumnElementBase> GenerateColumnElement(const RColumnElementBase::RIdentifier &elementId);
142142

143143
template <typename CppT>
144-
std::unique_ptr<RColumnElementBase> RColumnElementBase::Generate(EColumnType onDiskType)
144+
std::unique_ptr<RColumnElementBase> RColumnElementBase::Generate(ENTupleColumnType onDiskType)
145145
{
146146
return GenerateColumnElement(std::type_index(typeid(CppT)), onDiskType);
147147
}
148148

149149
template <>
150-
std::unique_ptr<RColumnElementBase> RColumnElementBase::Generate<void>(EColumnType onDiskType);
150+
std::unique_ptr<RColumnElementBase> RColumnElementBase::Generate<void>(ENTupleColumnType onDiskType);
151151

152152
} // namespace ROOT::Experimental::Internal
153153

tree/ntuple/v7/inc/ROOT/RField/RFieldFundamental.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ protected:
378378
fAvailableColumns.reserve(n);
379379
for (std::uint16_t i = 0; i < n; ++i) {
380380
auto &column = fAvailableColumns.emplace_back(Internal::RColumn::Create<T>(r[i][0], 0, i));
381-
if (r[i][0] == EColumnType::kReal32Trunc) {
381+
if (r[i][0] == ENTupleColumnType::kReal32Trunc) {
382382
column->SetBitsOnStorage(fBitWidth);
383-
} else if (r[i][0] == EColumnType::kReal32Quant) {
383+
} else if (r[i][0] == ENTupleColumnType::kReal32Quant) {
384384
column->SetBitsOnStorage(fBitWidth);
385385
column->SetValueRange(fValueMin, fValueMax);
386386
}
@@ -398,11 +398,11 @@ protected:
398398

399399
auto &column =
400400
fAvailableColumns.emplace_back(Internal::RColumn::Create<T>(onDiskTypes[0], 0, representationIndex));
401-
if (onDiskTypes[0] == EColumnType::kReal32Trunc) {
401+
if (onDiskTypes[0] == ENTupleColumnType::kReal32Trunc) {
402402
const auto &fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
403403
const auto &coldesc = desc.GetColumnDescriptor(fdesc.GetLogicalColumnIds()[0]);
404404
column->SetBitsOnStorage(coldesc.GetBitsOnStorage());
405-
} else if (onDiskTypes[0] == EColumnType::kReal32Quant) {
405+
} else if (onDiskTypes[0] == ENTupleColumnType::kReal32Quant) {
406406
const auto &fdesc = desc.GetFieldDescriptor(Base::GetOnDiskId());
407407
const auto &coldesc = desc.GetColumnDescriptor(fdesc.GetLogicalColumnIds()[0]);
408408
assert(coldesc.GetValueRange().has_value());
@@ -432,7 +432,7 @@ public:
432432
/// Sets this field to use a half precision representation, occupying half as much storage space (16 bits:
433433
/// 1 sign bit, 5 exponent bits, 10 mantissa bits) on disk.
434434
/// This is mutually exclusive with `SetTruncated` and `SetQuantized` and supersedes them if called after them.
435-
void SetHalfPrecision() { SetColumnRepresentatives({{EColumnType::kReal16}}); }
435+
void SetHalfPrecision() { SetColumnRepresentatives({{ENTupleColumnType::kReal16}}); }
436436

437437
/// Set the on-disk representation of this field to a single-precision float truncated to `nBits`.
438438
/// The remaining (32 - `nBits`) bits will be truncated from the number's mantissa.
@@ -442,13 +442,13 @@ public:
442442
/// This is mutually exclusive with `SetHalfPrecision` and `SetQuantized` and supersedes them if called after them.
443443
void SetTruncated(std::size_t nBits)
444444
{
445-
const auto &[minBits, maxBits] = Internal::RColumnElementBase::GetValidBitRange(EColumnType::kReal32Trunc);
445+
const auto &[minBits, maxBits] = Internal::RColumnElementBase::GetValidBitRange(ENTupleColumnType::kReal32Trunc);
446446
if (nBits < minBits || nBits > maxBits) {
447447
throw RException(R__FAIL("SetTruncated() argument nBits = " + std::to_string(nBits) +
448448
" is out of valid range [" + std::to_string(minBits) + ", " +
449449
std::to_string(maxBits) + "])"));
450450
}
451-
SetColumnRepresentatives({{EColumnType::kReal32Trunc}});
451+
SetColumnRepresentatives({{ENTupleColumnType::kReal32Trunc}});
452452
fBitWidth = nBits;
453453
}
454454

@@ -462,13 +462,13 @@ public:
462462
/// This is mutually exclusive with `SetTruncated` and `SetHalfPrecision` and supersedes them if called after them.
463463
void SetQuantized(double minValue, double maxValue, std::size_t nBits)
464464
{
465-
const auto &[minBits, maxBits] = Internal::RColumnElementBase::GetValidBitRange(EColumnType::kReal32Quant);
465+
const auto &[minBits, maxBits] = Internal::RColumnElementBase::GetValidBitRange(ENTupleColumnType::kReal32Quant);
466466
if (nBits < minBits || nBits > maxBits) {
467467
throw RException(R__FAIL("SetQuantized() argument nBits = " + std::to_string(nBits) +
468468
" is out of valid range [" + std::to_string(minBits) + ", " +
469469
std::to_string(maxBits) + "])"));
470470
}
471-
SetColumnRepresentatives({{EColumnType::kReal32Quant}});
471+
SetColumnRepresentatives({{ENTupleColumnType::kReal32Quant}});
472472
fBitWidth = nBits;
473473
fValueMin = minValue;
474474
fValueMax = maxValue;

tree/ntuple/v7/inc/ROOT/RFieldBase.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public:
127127
/// Shorthand for types that are both trivially constructible and destructible
128128
static constexpr int kTraitTrivialType = kTraitTriviallyConstructible | kTraitTriviallyDestructible;
129129

130-
using ColumnRepresentation_t = std::vector<EColumnType>;
130+
using ColumnRepresentation_t = std::vector<ENTupleColumnType>;
131131

132132
/// During its lifetime, a field undergoes the following possible state transitions:
133133
///

tree/ntuple/v7/inc/ROOT/RNTupleDescriptor.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private:
185185
/// but low-precision float columns have variable bit widths.
186186
std::uint16_t fBitsOnStorage = 0;
187187
/// The on-disk column type
188-
EColumnType fType = EColumnType::kUnknown;
188+
ENTupleColumnType fType = ENTupleColumnType::kUnknown;
189189
/// Optional value range (used e.g. by quantized real fields)
190190
std::optional<RValueRange> fValueRange;
191191

@@ -207,7 +207,7 @@ public:
207207
std::uint16_t GetRepresentationIndex() const { return fRepresentationIndex; }
208208
std::uint64_t GetFirstElementIndex() const { return std::abs(fFirstElementIndex); }
209209
std::uint16_t GetBitsOnStorage() const { return fBitsOnStorage; }
210-
EColumnType GetType() const { return fType; }
210+
ENTupleColumnType GetType() const { return fType; }
211211
std::optional<RValueRange> GetValueRange() const { return fValueRange; }
212212
bool IsAliasColumn() const { return fPhysicalColumnId != fLogicalColumnId; }
213213
bool IsDeferredColumn() const { return fFirstElementIndex != 0; }
@@ -1062,7 +1062,7 @@ public:
10621062
fColumn.fBitsOnStorage = bitsOnStorage;
10631063
return *this;
10641064
}
1065-
RColumnDescriptorBuilder &Type(EColumnType type)
1065+
RColumnDescriptorBuilder &Type(ENTupleColumnType type)
10661066
{
10671067
fColumn.fType = type;
10681068
return *this;

tree/ntuple/v7/inc/ROOT/RNTupleSerialize.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TVirtualStreamerInfo;
3535
namespace ROOT {
3636
namespace Experimental {
3737

38-
enum class EColumnType;
38+
enum class ENTupleColumnType;
3939
enum class EExtraTypeInfoIds;
4040
class RClusterDescriptor;
4141
class RNTupleDescriptor;
@@ -214,11 +214,11 @@ public:
214214
/// While we could just interpret the enums as ints, we make the translation explicit
215215
/// in order to avoid accidentally changing the on-disk numbers when adjusting the enum classes.
216216
static std::uint32_t SerializeFieldStructure(ROOT::Experimental::ENTupleStructure structure, void *buffer);
217-
static std::uint32_t SerializeColumnType(ROOT::Experimental::EColumnType type, void *buffer);
217+
static std::uint32_t SerializeColumnType(ROOT::Experimental::ENTupleColumnType type, void *buffer);
218218
static std::uint32_t SerializeExtraTypeInfoId(ROOT::Experimental::EExtraTypeInfoIds id, void *buffer);
219219
static RResult<std::uint32_t>
220220
DeserializeFieldStructure(const void *buffer, ROOT::Experimental::ENTupleStructure &structure);
221-
static RResult<std::uint32_t> DeserializeColumnType(const void *buffer, ROOT::Experimental::EColumnType &type);
221+
static RResult<std::uint32_t> DeserializeColumnType(const void *buffer, ROOT::Experimental::ENTupleColumnType &type);
222222
static RResult<std::uint32_t>
223223
DeserializeExtraTypeInfoId(const void *buffer, ROOT::Experimental::EExtraTypeInfoIds &id);
224224

tree/ntuple/v7/inc/ROOT/RNTupleUtil.hxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ROOT::RLogChannel &NTupleLog();
5757

5858
// clang-format off
5959
/**
60-
\class ROOT::Experimental::EColumnType
60+
\class ROOT::Experimental::ENTupleColumnType
6161
\ingroup NTuple
6262
\brief The available trivial, native content types of a column
6363
@@ -71,7 +71,7 @@ When changed, remember to update
7171
- RNTupleSerializer::[Des|S]erializeColumnType
7272
*/
7373
// clang-format on
74-
enum class EColumnType {
74+
enum class ENTupleColumnType {
7575
kUnknown = 0,
7676
// type for root columns of (nested) collections; offsets are relative to the current cluster
7777
kIndex64,
@@ -299,8 +299,8 @@ std::unique_ptr<T[]> MakeUninitArray(std::size_t size)
299299
return std::unique_ptr<T[]>(new T[size]);
300300
}
301301

302-
inline constexpr EColumnType kTestFutureType =
303-
static_cast<EColumnType>(std::numeric_limits<std::underlying_type_t<EColumnType>>::max() - 1);
302+
inline constexpr ENTupleColumnType kTestFutureType =
303+
static_cast<ENTupleColumnType>(std::numeric_limits<std::underlying_type_t<ENTupleColumnType>>::max() - 1);
304304

305305
inline constexpr ENTupleStructure kTestFutureFieldStructure =
306306
static_cast<ENTupleStructure>(std::numeric_limits<std::underlying_type_t<ENTupleStructure>>::max() - 1);

tree/ntuple/v7/src/RColumn.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <cassert>
2424
#include <utility>
2525

26-
ROOT::Experimental::Internal::RColumn::RColumn(EColumnType type, std::uint32_t columnIndex,
26+
ROOT::Experimental::Internal::RColumn::RColumn(ENTupleColumnType type, std::uint32_t columnIndex,
2727
std::uint16_t representationIndex)
2828
: fType(type), fIndex(columnIndex), fRepresentationIndex(representationIndex), fTeam({this})
2929
{

0 commit comments

Comments
 (0)