The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
DataTypeInfo.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
GaudiKernel/DataTypeInfo.h
>
12
#include <
GaudiKernel/IOpaqueAddress.h
>
13
#include <
GaudiKernel/System.h
>
14
15
// Access to type information
16
DataTypeInfo::Type
DataTypeInfo::idByName
(
const
std::string& typ ) {
17
if
( typ ==
"unsigned char"
|| typ ==
"const unsigned char"
)
18
return
UCHAR
;
19
else
if
( typ ==
"unsigned short"
|| typ ==
"const unsigned short"
)
20
return
USHORT
;
21
else
if
( typ ==
"unsigned int"
|| typ ==
"const unsigned int"
)
22
return
UINT
;
23
else
if
( typ ==
"unsigned long"
|| typ ==
"const unsigned long"
)
24
return
ULONG
;
25
else
if
( typ ==
"char"
|| typ ==
"const char"
)
26
return
CHAR
;
27
else
if
( typ ==
"short"
|| typ ==
"const short"
)
28
return
SHORT
;
29
else
if
( typ ==
"int"
|| typ ==
"const int"
)
30
return
INT
;
31
else
if
( typ ==
"long"
|| typ ==
"const long"
)
32
return
LONG
;
33
else
if
( typ ==
"bool"
|| typ ==
"const bool"
)
34
return
BOOL
;
35
else
if
( typ ==
"float"
|| typ ==
"const float"
)
36
return
FLOAT
;
37
else
if
( typ ==
"double"
|| typ ==
"const double"
)
38
return
DOUBLE
;
39
else
if
( typ ==
"std::string"
|| typ ==
"const std::string"
)
40
return
STRING
;
41
else
if
( typ ==
"char*"
|| typ ==
"const char*"
)
42
return
NTCHAR
;
43
else
if
( typ ==
"IOpaqueAddress*"
|| typ ==
"const IOpaqueAddress*"
)
44
return
OBJECT_ADDR
;
45
else
if
( typ ==
"SmartRef<DataObject>"
|| typ ==
"const SmartRef<DataObject>"
)
46
return
OBJECT_REF
;
47
else
if
( typ ==
"SmartRef<ContainedObject>"
|| typ ==
"const SmartRef<ContainedObject>"
)
48
return
CONTAINED_REF
;
49
else
if
( typ ==
"void*"
|| typ ==
"const void*"
)
50
return
POINTER
;
51
else
52
return
UNKNOWN
;
53
}
54
55
// Access to type information
56
const
std::type_info&
DataTypeInfo::typeByName
(
const
std::string& typ ) {
57
if
( typ ==
"unsigned char"
|| typ ==
"const unsigned char"
)
58
return
typeid
(
unsigned
char );
59
else
if
( typ ==
"unsigned short"
|| typ ==
"const unsigned short"
)
60
return
typeid
(
unsigned
short );
61
else
if
( typ ==
"unsigned int"
|| typ ==
"const unsigned int"
)
62
return
typeid
(
unsigned
int );
63
else
if
( typ ==
"unsigned long"
|| typ ==
"const unsigned long"
)
64
return
typeid
(
unsigned
long );
65
else
if
( typ ==
"char"
|| typ ==
"const char"
)
66
return
typeid
( char );
67
else
if
( typ ==
"short"
|| typ ==
"const short"
)
68
return
typeid
( short );
69
else
if
( typ ==
"int"
|| typ ==
"const int"
)
70
return
typeid
( int );
71
else
if
( typ ==
"long"
|| typ ==
"const long"
)
72
return
typeid
( long );
73
else
if
( typ ==
"bool"
|| typ ==
"const bool"
)
74
return
typeid
( bool );
75
else
if
( typ ==
"float"
|| typ ==
"const float"
)
76
return
typeid
( float );
77
else
if
( typ ==
"double"
|| typ ==
"const double"
)
78
return
typeid
( double );
79
else
if
( typ ==
"std::string"
|| typ ==
"const std::string"
)
80
return
typeid
( std::string );
81
else
if
( typ ==
"char*"
|| typ ==
"const char*"
)
82
return
typeid
(
char
* );
83
else
if
( typ ==
"IOpaqueAddress*"
|| typ ==
"const IOpaqueAddress*"
)
84
return
typeid
(
IOpaqueAddress
);
85
else
if
( typ ==
"SmartRef<DataObject>"
|| typ ==
"const SmartRef<DataObject>"
)
86
return
typeid
(
DataObject
* );
87
else
if
( typ ==
"SmartRef<ContainedObject>"
|| typ ==
"const SmartRef<ContainedObject>"
)
88
return
typeid
(
SmartRef<ContainedObject>
);
89
else
90
return
typeid
(
void
* );
91
}
92
93
// Access the type name by type ID
94
std::string
DataTypeInfo::name
(
long
typ ) {
95
switch
( typ ) {
96
case
UCHAR
:
97
return
System::typeinfoName
(
typeid
(
unsigned
char
) );
98
case
USHORT
:
99
return
System::typeinfoName
(
typeid
(
unsigned
short
) );
100
case
UINT
:
101
return
System::typeinfoName
(
typeid
(
unsigned
int
) );
102
case
ULONG
:
103
return
System::typeinfoName
(
typeid
(
unsigned
long
) );
104
case
CHAR
:
105
return
System::typeinfoName
(
typeid
(
char
) );
106
case
SHORT
:
107
return
System::typeinfoName
(
typeid
(
short
) );
108
case
INT
:
109
return
System::typeinfoName
(
typeid
(
int
) );
110
case
LONG
:
111
return
System::typeinfoName
(
typeid
(
long
) );
112
case
BOOL
:
113
return
System::typeinfoName
(
typeid
(
bool
) );
114
case
FLOAT
:
115
return
System::typeinfoName
(
typeid
(
float
) );
116
case
DOUBLE
:
117
return
System::typeinfoName
(
typeid
(
double
) );
118
case
STRING
:
119
return
System::typeinfoName
(
typeid
( std::string ) );
120
case
LONG_STRING
:
121
return
System::typeinfoName
(
typeid
( std::string ) );
122
case
NTCHAR
:
123
return
System::typeinfoName
(
typeid
(
char
* ) );
124
case
LONG_NTCHAR
:
125
return
System::typeinfoName
(
typeid
(
char
* ) );
126
case
OBJECT_ADDR
:
127
return
System::typeinfoName
(
typeid
(
IOpaqueAddress
* ) );
128
case
OBJECT_REF
:
129
return
System::typeinfoName
(
typeid
(
SmartRef<DataObject>
) );
130
case
CONTAINED_REF
:
131
return
System::typeinfoName
(
typeid
(
SmartRef<ContainedObject>
) );
132
case
POINTER
:
133
return
System::typeinfoName
(
typeid
(
void
* ) );
134
case
UNKNOWN
:
135
default
:
136
return
""
;
137
}
138
}
139
140
// Access the type name by type_info
141
std::string
DataTypeInfo::name
(
const
std::type_info& typ ) {
142
if
( typ ==
typeid
(
unsigned
char
) )
143
return
DataTypeInfo::name
(
UCHAR
);
144
else
if
( typ ==
typeid
(
unsigned
short
) )
145
return
DataTypeInfo::name
(
USHORT
);
146
else
if
( typ ==
typeid
(
unsigned
int
) )
147
return
DataTypeInfo::name
(
UINT
);
148
else
if
( typ ==
typeid
(
unsigned
long
) )
149
return
DataTypeInfo::name
(
ULONG
);
150
else
if
( typ ==
typeid
(
char
) )
151
return
DataTypeInfo::name
(
CHAR
);
152
else
if
( typ ==
typeid
(
short
) )
153
return
DataTypeInfo::name
(
SHORT
);
154
else
if
( typ ==
typeid
(
int
) )
155
return
DataTypeInfo::name
(
INT
);
156
else
if
( typ ==
typeid
(
long
) )
157
return
DataTypeInfo::name
(
LONG
);
158
else
if
( typ ==
typeid
(
bool
) )
159
return
DataTypeInfo::name
(
BOOL
);
160
else
if
( typ ==
typeid
(
float
) )
161
return
DataTypeInfo::name
(
FLOAT
);
162
else
if
( typ ==
typeid
(
double
) )
163
return
DataTypeInfo::name
(
DOUBLE
);
164
else
if
( typ ==
typeid
( std::string ) )
165
return
DataTypeInfo::name
(
STRING
);
166
else
if
( typ ==
typeid
(
char
* ) )
167
return
DataTypeInfo::name
(
NTCHAR
);
168
else
if
( typ ==
typeid
(
IOpaqueAddress
* ) )
169
return
DataTypeInfo::name
(
OBJECT_ADDR
);
170
else
if
( typ ==
typeid
(
SmartRef<DataObject>
) )
171
return
DataTypeInfo::name
(
OBJECT_REF
);
172
else
if
( typ ==
typeid
(
SmartRef<ContainedObject>
) )
173
return
DataTypeInfo::name
(
CONTAINED_REF
);
174
else
if
( typ ==
typeid
(
void
* ) )
175
return
DataTypeInfo::name
(
POINTER
);
176
else
177
return
DataTypeInfo::name
(
UNKNOWN
);
178
}
DataTypeInfo.h
IOpaqueAddress.h
System.h
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition
DataObject.h:37
DataTypeInfo::Type
Type
Definition
DataTypeInfo.h:32
DataTypeInfo::NTCHAR
@ NTCHAR
Definition
DataTypeInfo.h:46
DataTypeInfo::BOOL
@ BOOL
Definition
DataTypeInfo.h:42
DataTypeInfo::FLOAT
@ FLOAT
Definition
DataTypeInfo.h:43
DataTypeInfo::USHORT
@ USHORT
Definition
DataTypeInfo.h:35
DataTypeInfo::OBJECT_ADDR
@ OBJECT_ADDR
Definition
DataTypeInfo.h:50
DataTypeInfo::POINTER
@ POINTER
Definition
DataTypeInfo.h:49
DataTypeInfo::CONTAINED_REF
@ CONTAINED_REF
Definition
DataTypeInfo.h:48
DataTypeInfo::CHAR
@ CHAR
Definition
DataTypeInfo.h:38
DataTypeInfo::UNKNOWN
@ UNKNOWN
Definition
DataTypeInfo.h:33
DataTypeInfo::OBJECT_REF
@ OBJECT_REF
Definition
DataTypeInfo.h:47
DataTypeInfo::STRING
@ STRING
Definition
DataTypeInfo.h:45
DataTypeInfo::SHORT
@ SHORT
Definition
DataTypeInfo.h:39
DataTypeInfo::INT
@ INT
Definition
DataTypeInfo.h:40
DataTypeInfo::LONG_NTCHAR
@ LONG_NTCHAR
Definition
DataTypeInfo.h:52
DataTypeInfo::UCHAR
@ UCHAR
Definition
DataTypeInfo.h:34
DataTypeInfo::LONG
@ LONG
Definition
DataTypeInfo.h:41
DataTypeInfo::LONG_STRING
@ LONG_STRING
Definition
DataTypeInfo.h:51
DataTypeInfo::UINT
@ UINT
Definition
DataTypeInfo.h:36
DataTypeInfo::ULONG
@ ULONG
Definition
DataTypeInfo.h:37
DataTypeInfo::DOUBLE
@ DOUBLE
Definition
DataTypeInfo.h:44
DataTypeInfo::name
static std::string name(long typ)
Definition
DataTypeInfo.cpp:94
DataTypeInfo::typeByName
static const std::type_info & typeByName(const std::string &typ)
Access to type information.
Definition
DataTypeInfo.cpp:56
DataTypeInfo::idByName
static Type idByName(const std::string &typ)
Access to type information.
Definition
DataTypeInfo.cpp:16
IOpaqueAddress
Opaque address interface definition.
Definition
IOpaqueAddress.h:28
SmartRef
Kernel objects: SmartRef.
Definition
SmartRef.h:64
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition
System.cpp:254
GaudiKernel
src
Lib
DataTypeInfo.cpp
Generated on
for The Gaudi Framework by
1.17.0