ATLAS Offline Software
Control
AthenaKernel
AthenaKernel
Control/AthenaKernel/AthenaKernel/CLASS_DEF.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef ATHENAKERNEL_CLASS_DEF_H
6
#define ATHENAKERNEL_CLASS_DEF_H
7
13
#include "
AthenaKernel/ClassID_traits.h
"
14
#include "
CxxUtils/checker_macros.h
"
15
16
#ifdef __CLING__
17
# define CLIDREGISTRY_ADDENTRY(CID, NAME) \
18
namespace detail { \
19
[[maybe_unused]] \
20
const bool clidEntry_ ## CID = \
21
CLIDRegistry::addEntry(CID, typeid(NAME), \
22
ClassID_traits< NAME >::typeNameString(), \
23
ClassName< NAME >::name()); \
24
}
25
# define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) \
26
namespace detail { \
27
[[maybe_unused]] \
28
const bool clidEntry_ ## CID = \
29
CLIDRegistry::addEntry \
30
(CID, typeid(ARG1,ARG2), \
31
ClassID_traits< ARG1,ARG2 >::typeNameString(), \
32
ClassName< ARG1,ARG2 >::name()); \
33
}
34
#else
35
# define CLIDREGISTRY_ADDENTRY(CID, NAME) \
36
namespace detail { \
37
[[maybe_unused]] \
38
const bool clidEntry_ ## CID = \
39
CLIDRegistry::addEntry<CID>(typeid(NAME), \
40
ClassID_traits< NAME >::typeNameString(), \
41
ClassName< NAME >::name()); \
42
}
43
# define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) \
44
namespace detail { \
45
[[maybe_unused]] \
46
const bool clidEntry_ ## CID = \
47
CLIDRegistry::addEntry<CID> \
48
(typeid(ARG1,ARG2), \
49
ClassID_traits< ARG1,ARG2 >::typeNameString(), \
50
ClassName< ARG1,ARG2 >::name()); \
51
}
52
#endif
53
64
#define CLASS_DEF(NAME, CID , VERSION) \
65
template <> \
66
struct ClassID_traits< NAME > { \
67
typedef std::is_base_of<DataObject, NAME> isDObj_t; \
68
static const bool s_isDataObject = isDObj_t::value; \
69
typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \
70
typedef std::true_type has_classID_tag; \
71
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { static const CLID c(CID); return c; } \
72
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
73
return #NAME; \
74
} \
75
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
76
static const std::string name = typeNameString(); \
77
return name; \
78
} \
79
static const std::type_info& typeInfo() { \
80
return typeid (NAME); \
81
} \
82
typedef std::true_type has_version_tag; \
83
static const int s_version = VERSION; \
84
static const bool s_isConst = false; \
85
}; \
86
CLIDREGISTRY_ADDENTRY(CID, NAME)
87
88
100
#define CLASS_DEF2(ARG1, ARG2, CID , VERSION) \
101
template <> \
102
struct ClassID_traits< ARG1,ARG2 > { \
103
typedef std::is_base_of<DataObject, ARG1, ARG2 > isDObj_t; \
104
static const bool s_isDataObject = isDObj_t::value; \
105
typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \
106
typedef std::true_type has_classID_tag; \
107
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { \
108
static const CLID c(CID); return c; \
109
} \
110
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
111
return #ARG1 "," #ARG2; \
112
} \
113
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
114
static const std::string name = typeNameString(); \
115
return name; \
116
} \
117
static const std::type_info& typeInfo() { \
118
return typeid (ARG1,ARG2); \
119
} \
120
typedef std::true_type has_version_tag; \
121
static const int s_version = VERSION; \
122
static const bool s_isConst = false; \
123
}; \
124
CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2)
125
126
#endif // not ATHENAKERNEL_CLASS_DEF_H
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
checker_macros.h
Define macros for attributes used to control the static checker.
Generated on Thu Nov 7 2024 21:11:56 for ATLAS Offline Software by
1.8.18