Project
Loading...
Searching...
No Matches
CheckTypes.h
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
#ifndef O2_FRAMEWORK_CHECKTYPES_H_
12
#define O2_FRAMEWORK_CHECKTYPES_H_
13
14
#include <algorithm>
15
#include <type_traits>
16
#include "
CompilerBuiltins.h
"
17
18
namespace
o2::framework
19
{
20
21
template
<
typename
T>
22
concept
TypeComplete
=
requires
(T) {
23
{
24
sizeof
(T)
25
};
26
};
27
28
template
<
typename
T>
29
constexpr
bool
is_type_complete_v
=
TypeComplete<T>
;
30
34
template
<
typename
T,
typename
TDefined,
typename
TUndefined>
35
void
call_if_defined_full
(TDefined&& onDefined, TUndefined&& onUndefined)
36
{
37
if
constexpr
(is_type_complete_v<T>) {
38
onDefined(
static_cast<
T*
>
(
nullptr
));
39
}
else
{
40
onUndefined();
41
}
42
}
43
44
template
<
typename
T,
typename
TDefined>
45
void
call_if_defined
(TDefined&& onDefined)
46
{
47
call_if_defined_full<T>(onDefined, []() ->
void
{});
48
}
49
50
}
// namespace o2::framework
51
52
#endif
// O2_FRAMEWORK_CHECKTYPES_H_
CompilerBuiltins.h
o2::framework::TypeComplete
Definition
CheckTypes.h:22
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
BunchFilling.h:112
o2::framework::call_if_defined_full
void call_if_defined_full(TDefined &&onDefined, TUndefined &&onUndefined)
Definition
CheckTypes.h:35
o2::framework::is_type_complete_v
constexpr bool is_type_complete_v
Definition
CheckTypes.h:29
o2::framework::call_if_defined
void call_if_defined(TDefined &&onDefined)
Definition
CheckTypes.h:45
Framework
Foundation
include
Framework
CheckTypes.h
Generated on Wed Dec 3 2025 21:54:19 for Project by
1.9.8