Gaudi Framework, version v23r7
Home
Generated: Wed Mar 20 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
src
Lib
DataTypeInfo.cpp
Go to the documentation of this file.
1
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/src/Lib/DataTypeInfo.cpp,v 1.5 2008/10/27 19:22:21 marcocle Exp $
2
// ====================================================================
3
//
4
// DataTypeInfo.cpp
5
// --------------------------------------------------------------------
6
//
7
// Package : Kernel
8
// Data Object types - implementation
9
//
10
// Author : Markus Frank
11
// History:
12
// +---------+----------------------------------------------+---------+
13
// | Date | Comment | Who |
14
// +---------+----------------------------------------------+---------+
15
// | 3/07/00 | Initial version | M.Frank |
16
// +---------+----------------------------------------------+---------+
17
// ====================================================================
18
#define GAUDI_KERNEL_DATATYPEINFO_CPP 1
19
20
#include "
GaudiKernel/System.h
"
21
#include "
GaudiKernel/DataTypeInfo.h
"
22
#include "
GaudiKernel/IOpaqueAddress.h
"
23
24
// Access to type information
25
DataTypeInfo::Type
DataTypeInfo::idByName
(
const
std::string
& typ ) {
26
if
( typ ==
"unsigned char"
|| typ ==
"const unsigned char"
)
27
return
UCHAR
;
28
else
if
( typ ==
"unsigned short"
|| typ ==
"const unsigned short"
)
29
return
USHORT
;
30
else
if
( typ ==
"unsigned int"
|| typ ==
"const unsigned int"
)
31
return
UINT
;
32
else
if
( typ ==
"unsigned long"
|| typ ==
"const unsigned long"
)
33
return
ULONG
;
34
else
if
( typ ==
"char"
|| typ ==
"const char"
)
35
return
CHAR
;
36
else
if
( typ ==
"short"
|| typ ==
"const short"
)
37
return
SHORT
;
38
else
if
( typ ==
"int"
|| typ ==
"const int"
)
39
return
INT
;
40
else
if
( typ ==
"long"
|| typ ==
"const long"
)
41
return
LONG
;
42
else
if
( typ ==
"bool"
|| typ ==
"const bool"
)
43
return
BOOL
;
44
else
if
( typ ==
"float"
|| typ ==
"const float"
)
45
return
FLOAT
;
46
else
if
( typ ==
"double"
|| typ ==
"const double"
)
47
return
DOUBLE
;
48
else
if
( typ ==
"std::string"
|| typ ==
"const std::string"
)
49
return
STRING
;
50
else
if
( typ ==
"char*"
|| typ ==
"const char*"
)
51
return
NTCHAR
;
52
else
if
( typ ==
"IOpaqueAddress*"
|| typ ==
"const IOpaqueAddress*"
)
53
return
OBJECT_ADDR
;
54
else
if
( typ ==
"SmartRef<DataObject>"
|| typ ==
"const SmartRef<DataObject>"
)
55
return
OBJECT_REF
;
56
else
if
( typ ==
"SmartRef<ContainedObject>"
|| typ ==
"const SmartRef<ContainedObject>"
)
57
return
CONTAINED_REF
;
58
else
if
( typ ==
"void*"
|| typ ==
"const void*"
)
59
return
POINTER
;
60
else
61
return
UNKNOWN
;
62
}
63
64
// Access to type information
65
const
std::type_info
&
DataTypeInfo::typeByName
(
const
std::string
& typ ) {
66
if
( typ ==
"unsigned char"
|| typ ==
"const unsigned char"
)
67
return
typeid
(
unsigned
char);
68
else
if
( typ ==
"unsigned short"
|| typ ==
"const unsigned short"
)
69
return
typeid
(
unsigned
short);
70
else
if
( typ ==
"unsigned int"
|| typ ==
"const unsigned int"
)
71
return
typeid
(
unsigned
int
);
72
else
if
( typ ==
"unsigned long"
|| typ ==
"const unsigned long"
)
73
return
typeid
(
unsigned
long);
74
else
if
( typ ==
"char"
|| typ ==
"const char"
)
75
return
typeid
(char);
76
else
if
( typ ==
"short"
|| typ ==
"const short"
)
77
return
typeid
(short);
78
else
if
( typ ==
"int"
|| typ ==
"const int"
)
79
return
typeid
(
int
);
80
else
if
( typ ==
"long"
|| typ ==
"const long"
)
81
return
typeid
(long);
82
else
if
( typ ==
"bool"
|| typ ==
"const bool"
)
83
return
typeid
(bool);
84
else
if
( typ ==
"float"
|| typ ==
"const float"
)
85
return
typeid
(float);
86
else
if
( typ ==
"double"
|| typ ==
"const double"
)
87
return
typeid
(double);
88
else
if
( typ ==
"std::string"
|| typ ==
"const std::string"
)
89
return
typeid
(
std::string
);
90
else
if
( typ ==
"char*"
|| typ ==
"const char*"
)
91
return
typeid
(
char
*);
92
else
if
( typ ==
"IOpaqueAddress*"
|| typ ==
"const IOpaqueAddress*"
)
93
return
typeid
(
IOpaqueAddress
);
94
else
if
( typ ==
"SmartRef<DataObject>"
|| typ ==
"const SmartRef<DataObject>"
)
95
return
typeid
(
DataObject
*);
96
else
if
( typ ==
"SmartRef<ContainedObject>"
|| typ ==
"const SmartRef<ContainedObject>"
)
97
return
typeid
(
SmartRef<ContainedObject>
);
98
else
if
( typ ==
"void*"
|| typ ==
"const void*"
)
99
return
typeid
(
void
*);
100
else
101
return
typeid
(
void
*);
102
}
103
104
// Access the type name by type ID
105
std::string
DataTypeInfo::name
(
long
typ) {
106
switch
(typ) {
107
case
UCHAR
:
108
return
System::typeinfoName
(
typeid
(
unsigned
char
));
109
case
USHORT
:
110
return
System::typeinfoName
(
typeid
(
unsigned
short
));
111
case
UINT
:
112
return
System::typeinfoName
(
typeid
(
unsigned
int
));
113
case
ULONG
:
114
return
System::typeinfoName
(
typeid
(
unsigned
long
));
115
case
CHAR
:
116
return
System::typeinfoName
(
typeid
(
char
));
117
case
SHORT
:
118
return
System::typeinfoName
(
typeid
(
short
));
119
case
INT
:
120
return
System::typeinfoName
(
typeid
(
int
));
121
case
LONG
:
122
return
System::typeinfoName
(
typeid
(
long
));
123
case
BOOL
:
124
return
System::typeinfoName
(
typeid
(
bool
));
125
case
FLOAT
:
126
return
System::typeinfoName
(
typeid
(
float
));
127
case
DOUBLE
:
128
return
System::typeinfoName
(
typeid
(
double
));
129
case
STRING
:
130
return
System::typeinfoName
(
typeid
(
std::string
));
131
case
LONG_STRING
:
132
return
System::typeinfoName
(
typeid
(
std::string
));
133
case
NTCHAR
:
134
return
System::typeinfoName
(
typeid
(
char
*));
135
case
LONG_NTCHAR
:
136
return
System::typeinfoName
(
typeid
(
char
*));
137
case
OBJECT_ADDR
:
138
return
System::typeinfoName
(
typeid
(
IOpaqueAddress
*));
139
case
OBJECT_REF
:
140
return
System::typeinfoName
(
typeid
(
SmartRef<DataObject>
));
141
case
CONTAINED_REF
:
142
return
System::typeinfoName
(
typeid
(
SmartRef<ContainedObject>
));
143
case
POINTER
:
144
return
System::typeinfoName
(
typeid
(
void
*));
145
case
UNKNOWN
:
146
default
:
147
return
""
;
148
}
149
}
150
151
// Access the type name by type_info
152
std::string
DataTypeInfo::name
(
const
std::type_info
& typ) {
153
if
( typ ==
typeid
(
unsigned
char
) )
154
return
DataTypeInfo::name
(
UCHAR
);
155
else
if
( typ ==
typeid
(
unsigned
short
) )
156
return
DataTypeInfo::name
(
USHORT
);
157
else
if
( typ ==
typeid
(
unsigned
int
) )
158
return
DataTypeInfo::name
(
UINT
);
159
else
if
( typ ==
typeid
(
unsigned
long
) )
160
return
DataTypeInfo::name
(
ULONG
);
161
else
if
( typ ==
typeid
(
char
) )
162
return
DataTypeInfo::name
(
CHAR
);
163
else
if
( typ ==
typeid
(
short
) )
164
return
DataTypeInfo::name
(
SHORT
);
165
else
if
( typ ==
typeid
(
int
) )
166
return
DataTypeInfo::name
(
INT
);
167
else
if
( typ ==
typeid
(
long
) )
168
return
DataTypeInfo::name
(
LONG
);
169
else
if
( typ ==
typeid
(
bool
) )
170
return
DataTypeInfo::name
(
BOOL
);
171
else
if
( typ ==
typeid
(
float
) )
172
return
DataTypeInfo::name
(
FLOAT
);
173
else
if
( typ ==
typeid
(
double
) )
174
return
DataTypeInfo::name
(
DOUBLE
);
175
else
if
( typ ==
typeid
(
std::string
) )
176
return
DataTypeInfo::name
(
STRING
);
177
else
if
( typ ==
typeid
(
char
*) )
178
return
DataTypeInfo::name
(
NTCHAR
);
179
else
if
( typ ==
typeid
(
IOpaqueAddress
*) )
180
return
DataTypeInfo::name
(
OBJECT_ADDR
);
181
else
if
( typ ==
typeid
(
SmartRef<DataObject>
) )
182
return
DataTypeInfo::name
(
OBJECT_REF
);
183
else
if
( typ ==
typeid
(
SmartRef<ContainedObject>
) )
184
return
DataTypeInfo::name
(
CONTAINED_REF
);
185
else
if
( typ ==
typeid
(
void
*) )
186
return
DataTypeInfo::name
(
POINTER
);
187
else
188
return
DataTypeInfo::name
(
UNKNOWN
);
189
}
Generated at Wed Mar 20 2013 17:59:39 for Gaudi Framework, version v23r7 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004