ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Columnar
ColumnarInterfaces
ColumnarInterfaces
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
11
#include <
ColumnarInterfaces/ColumnInfo.h
>
12
22
23
namespace
columnar
24
{
27
[[nodiscard]]
constexpr
bool
isIntegerTypeCategory
(
ColumnTypeCategory
category)
noexcept
28
{
29
return
category ==
ColumnTypeCategory::signedInteger
||
30
category ==
ColumnTypeCategory::unsignedInteger
||
31
category ==
ColumnTypeCategory::signAgnosticInteger
||
32
category ==
ColumnTypeCategory::boolean
;
33
}
34
35
41
[[nodiscard]]
constexpr
ColumnTypeCategory
42
mergeColumnTypeCategory
(
ColumnTypeCategory
a
,
ColumnTypeCategory
b)
noexcept
43
{
44
if
(
a
== b || b ==
ColumnTypeCategory::boolean
)
45
return
a
;
46
if
(
a
==
ColumnTypeCategory::boolean
)
47
return
b;
48
if
(b ==
ColumnTypeCategory::signAgnosticInteger
)
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
{
72
case
ColumnTypeCategory::floatingPoint
:
73
case
ColumnTypeCategory::signedInteger
:
74
case
ColumnTypeCategory::unsignedInteger
:
75
return
dataCategory == columnCategory ||
76
(isConst && dataCategory ==
ColumnTypeCategory::boolean
&& columnCategory !=
ColumnTypeCategory::floatingPoint
);
77
case
ColumnTypeCategory::signAgnosticInteger
:
78
return
isIntegerTypeCategory
(dataCategory) &&
79
(isConst || dataCategory !=
ColumnTypeCategory::boolean
);
80
case
ColumnTypeCategory::boolean
:
81
return
isIntegerTypeCategory
(dataCategory);
82
case
ColumnTypeCategory::other
:
83
return
false
;
84
}
85
return
false
;
86
}
87
88
90
[[nodiscard]]
constexpr
const
char
*
91
columnTypeCategoryName
(
ColumnTypeCategory
category)
noexcept
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
ColumnInfo.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
columnar
Definition
ClusterDef.h:16
columnar::ColumnTypeCategory
ColumnTypeCategory
the category of type we use for a column
Definition
ColumnInfo.h:38
columnar::ColumnTypeCategory::unsignedInteger
@ unsignedInteger
an unsigned integer type
Definition
ColumnInfo.h:46
columnar::ColumnTypeCategory::signAgnosticInteger
@ signAgnosticInteger
a sign-agnostic type
Definition
ColumnInfo.h:54
columnar::ColumnTypeCategory::other
@ other
some other type
Definition
ColumnInfo.h:65
columnar::ColumnTypeCategory::floatingPoint
@ floatingPoint
a floating-point type
Definition
ColumnInfo.h:40
columnar::ColumnTypeCategory::signedInteger
@ signedInteger
a signed integer type
Definition
ColumnInfo.h:43
columnar::ColumnTypeCategory::boolean
@ boolean
a boolean type
Definition
ColumnInfo.h:62
columnar::columnTypeCategoryName
constexpr const char * columnTypeCategoryName(ColumnTypeCategory category) noexcept
a human readable name for the category (for messages)
Definition
ColumnarInterfaces/ColumnarInterfaces/ColumnInfoHelpers.h:91
columnar::mergeColumnTypeCategory
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...
Definition
ColumnarInterfaces/ColumnarInterfaces/ColumnInfoHelpers.h:42
columnar::isColumnTypeCompatible
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
Definition
ColumnarInterfaces/ColumnarInterfaces/ColumnInfoHelpers.h:66
columnar::isIntegerTypeCategory
constexpr bool isIntegerTypeCategory(ColumnTypeCategory category) noexcept
whether the category is one of the integer categories (including boolean)
Definition
ColumnarInterfaces/ColumnarInterfaces/ColumnInfoHelpers.h:27
Generated on
for ATLAS Offline Software by
1.17.0