ATLAS Offline Software
Loading...
Searching...
No Matches
CLASS_DEF.h File Reference

macros to associate a CLID to a type More...

#include "AthenaKernel/ClassID_traits.h"
#include "AthenaKernel/ClassName.h"
#include "AthenaKernel/CLIDRegistry.h"
#include "CxxUtils/checker_macros.h"
#include "GaudiKernel/DataObject.h"
Include dependency graph for Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:

Go to the source code of this file.

Macros

#define CLIDREGISTRY_ADDENTRY(CID, NAME)
#define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2)
#define CLASS_DEF(NAME, CID, VERSION)
 associate a clid and a version to a type eg
#define CLASS_DEF2(ARG1, ARG2, CID, VERSION)
 hack to use instead of CLASS_DEF when type name contains a comma ',' eg

Detailed Description

macros to associate a CLID to a type

Author
Paolo Calafiura pcala.nosp@m.fiur.nosp@m.a@lbl.nosp@m..gov

Definition in file Control/AthenaKernel/AthenaKernel/CLASS_DEF.h.

Macro Definition Documentation

◆ CLASS_DEF

#define CLASS_DEF ( NAME,
CID,
VERSION )
Value:
template <> \
struct ClassID_traits< NAME > { \
typedef std::is_base_of<DataObject, NAME> isDObj_t; \
static const bool s_isDataObject = isDObj_t::value; \
typedef std::true_type has_classID_tag; \
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { static const CLID c(CID); return c; } \
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
return #NAME; \
} \
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
static const std::string name = typeNameString(); \
return name; \
} \
static const std::type_info& typeInfo() { \
return typeid (NAME); \
} \
typedef std::true_type has_version_tag; \
static const int s_version = VERSION; \
static const bool s_isConst = false; \
}; \
CLIDREGISTRY_ADDENTRY(CID, NAME)
std::vector< Identifier > ID
uint32_t CLID
The Class ID type.
#define ATLAS_CHECK_THREAD_SAFETY
str VERSION
libDataQualityUtils is loaded by handi
Default, invalid implementation of ClassID_traits.

associate a clid and a version to a type eg

CLASS_DEF(std::vector<Track*>,8901, 1)
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Parameters
NAMEtype name
CIDclid
VERSIONnot yet used

Definition at line 67 of file Control/AthenaKernel/AthenaKernel/CLASS_DEF.h.

67#define CLASS_DEF(NAME, CID , VERSION) \
68 template <> \
69 struct ClassID_traits< NAME > { \
70 typedef std::is_base_of<DataObject, NAME> isDObj_t; \
71 static const bool s_isDataObject = isDObj_t::value; \
72 typedef std::true_type has_classID_tag; \
73 static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { static const CLID c(CID); return c; } \
74 static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
75 return #NAME; \
76 } \
77 static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
78 static const std::string name = typeNameString(); \
79 return name; \
80 } \
81 static const std::type_info& typeInfo() { \
82 return typeid (NAME); \
83 } \
84 typedef std::true_type has_version_tag; \
85 static const int s_version = VERSION; \
86 static const bool s_isConst = false; \
87 }; \
88 CLIDREGISTRY_ADDENTRY(CID, NAME)

◆ CLASS_DEF2

#define CLASS_DEF2 ( ARG1,
ARG2,
CID,
VERSION )
Value:
template <> \
struct ClassID_traits< ARG1,ARG2 > { \
typedef std::is_base_of<DataObject, ARG1, ARG2 > isDObj_t; \
static const bool s_isDataObject = isDObj_t::value; \
typedef std::true_type has_classID_tag; \
static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { \
static const CLID c(CID); return c; \
} \
static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
return #ARG1 "," #ARG2; \
} \
static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
static const std::string name = typeNameString(); \
return name; \
} \
static const std::type_info& typeInfo() { \
return typeid (ARG1,ARG2); \
} \
typedef std::true_type has_version_tag; \
static const int s_version = VERSION; \
static const bool s_isConst = false; \
}; \
CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2)

hack to use instead of CLASS_DEF when type name contains a comma ',' eg

#define CLASS_DEF2(ARG1, ARG2, CID, VERSION)
hack to use instead of CLASS_DEF when type name contains a comma ',' eg
STL class.
Parameters
ARG1type name (1st part)
ARG2type name (2nd part)
CIDclid
VERSIONnot yet used

Definition at line 102 of file Control/AthenaKernel/AthenaKernel/CLASS_DEF.h.

102#define CLASS_DEF2(ARG1, ARG2, CID , VERSION) \
103 template <> \
104 struct ClassID_traits< ARG1,ARG2 > { \
105 typedef std::is_base_of<DataObject, ARG1, ARG2 > isDObj_t; \
106 static const bool s_isDataObject = isDObj_t::value; \
107 typedef std::true_type has_classID_tag; \
108 static const CLID& ID ATLAS_CHECK_THREAD_SAFETY () { \
109 static const CLID c(CID); return c; \
110 } \
111 static const char* typeNameString ATLAS_CHECK_THREAD_SAFETY () { \
112 return #ARG1 "," #ARG2; \
113 } \
114 static const std::string& typeName ATLAS_CHECK_THREAD_SAFETY () { \
115 static const std::string name = typeNameString(); \
116 return name; \
117 } \
118 static const std::type_info& typeInfo() { \
119 return typeid (ARG1,ARG2); \
120 } \
121 typedef std::true_type has_version_tag; \
122 static const int s_version = VERSION; \
123 static const bool s_isConst = false; \
124 }; \
125 CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2)

◆ CLIDREGISTRY_ADDENTRY

#define CLIDREGISTRY_ADDENTRY ( CID,
NAME )
Value:
namespace detail { \
[[maybe_unused]] \
const bool clidEntry_ ## CID = \
CLIDRegistry::addEntry<CID>(typeid(NAME), \
}
static std::string name()
Return the name of class T as a string.

Definition at line 38 of file Control/AthenaKernel/AthenaKernel/CLASS_DEF.h.

38# define CLIDREGISTRY_ADDENTRY(CID, NAME) \
39 namespace detail { \
40 [[maybe_unused]] \
41 const bool clidEntry_ ## CID = \
42 CLIDRegistry::addEntry<CID>(typeid(NAME), \
43 ClassID_traits< NAME >::typeNameString(), \
44 ClassName< NAME >::name()); \
45 }

◆ CLIDREGISTRY_ADDENTRY2

#define CLIDREGISTRY_ADDENTRY2 ( CID,
ARG1,
ARG2 )
Value:
namespace detail { \
[[maybe_unused]] \
const bool clidEntry_ ## CID = \
(typeid(ARG1,ARG2), \
ClassID_traits< ARG1,ARG2 >::typeNameString(), \
ClassName< ARG1,ARG2 >::name()); \
}
static bool addEntry(const std::type_info &ti, const char *typeName, const std::string &typeInfoName)
to be called by the CLASS_DEFS

Definition at line 46 of file Control/AthenaKernel/AthenaKernel/CLASS_DEF.h.

46# define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) \
47 namespace detail { \
48 [[maybe_unused]] \
49 const bool clidEntry_ ## CID = \
50 CLIDRegistry::addEntry<CID> \
51 (typeid(ARG1,ARG2), \
52 ClassID_traits< ARG1,ARG2 >::typeNameString(), \
53 ClassName< ARG1,ARG2 >::name()); \
54 }