ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnarInterfaces/ColumnarInterfaces/ColumnInfoHelpers.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8#ifndef COLUMNAR_INTERFACES_COLUMN_INFO_HELPERS_H
9#define COLUMNAR_INTERFACES_COLUMN_INFO_HELPERS_H
10
12
22
23namespace columnar
24{
27 [[nodiscard]] constexpr bool isIntegerTypeCategory (ColumnTypeCategory category) noexcept
28 {
29 return category == ColumnTypeCategory::signedInteger ||
33 }
34
35
41 [[nodiscard]] constexpr ColumnTypeCategory
43 {
44 if (a == b || b == ColumnTypeCategory::boolean)
45 return a;
47 return b;
49 return a;
50 return b;
51 }
52
53
65 [[nodiscard]] constexpr bool
66 isColumnTypeCompatible (ColumnTypeCategory columnCategory, unsigned columnSize, ColumnTypeCategory dataCategory, unsigned dataSize, bool isConst) noexcept
67 {
68 if (columnSize != dataSize || columnSize == 0u)
69 return false;
70 switch (columnCategory)
71 {
75 return dataCategory == columnCategory ||
76 (isConst && dataCategory == ColumnTypeCategory::boolean && columnCategory != ColumnTypeCategory::floatingPoint);
78 return isIntegerTypeCategory (dataCategory) &&
79 (isConst || dataCategory != ColumnTypeCategory::boolean);
81 return isIntegerTypeCategory (dataCategory);
83 return false;
84 }
85 return false;
86 }
87
88
90 [[nodiscard]] constexpr const char *
92 {
93 switch (category)
94 {
95 case ColumnTypeCategory::floatingPoint: return "floatingPoint";
96 case ColumnTypeCategory::signedInteger: return "signedInteger";
97 case ColumnTypeCategory::unsignedInteger: return "unsignedInteger";
98 case ColumnTypeCategory::signAgnosticInteger: return "signAgnosticInteger";
99 case ColumnTypeCategory::boolean: return "boolean";
100 case ColumnTypeCategory::other: return "other";
101 }
102 return "unknown";
103 }
104}
105
106#endif
static Double_t a
ColumnTypeCategory
the category of type we use for a column
Definition ColumnInfo.h:38
@ unsignedInteger
an unsigned integer type
Definition ColumnInfo.h:46
@ signAgnosticInteger
a sign-agnostic type
Definition ColumnInfo.h:54
@ floatingPoint
a floating-point type
Definition ColumnInfo.h:40
@ signedInteger
a signed integer type
Definition ColumnInfo.h:43
constexpr const char * columnTypeCategoryName(ColumnTypeCategory category) noexcept
a human readable name for the category (for messages)
constexpr ColumnTypeCategory mergeColumnTypeCategory(ColumnTypeCategory a, ColumnTypeCategory b) noexcept
merge the type categories of two users of the same column (with the same type), the strictest one win...
constexpr bool isColumnTypeCompatible(ColumnTypeCategory columnCategory, unsigned columnSize, ColumnTypeCategory dataCategory, unsigned dataSize, bool isConst) noexcept
whether data of the given category and size can be used for a column with the given category and size
constexpr bool isIntegerTypeCategory(ColumnTypeCategory category) noexcept
whether the category is one of the integer categories (including boolean)