The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
Dictionary.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 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/System.h
>
12
namespace
GaudiDict
{
13
std::string
typeName
(
const
std::type_info& typ );
14
std::string
vectorName
(
const
std::type_info& typ );
15
std::string
vectorName
(
const
std::string& typ );
16
std::string
pairName
(
const
std::type_info& typ1,
const
std::type_info& typ2 );
17
std::string
relationName
(
const
std::string& prefix,
const
std::type_info& typ1,
const
std::type_info& typ2 );
18
std::string
templateName1
( std::string templ,
const
std::type_info& typ );
19
std::string
templateName1
( std::string templ,
const
std::string& typ );
20
std::string
templateName2
( std::string templ,
const
std::type_info& typ1,
const
std::type_info& typ2 );
21
std::string
templateName3
( std::string templ,
const
std::type_info& typ1,
const
std::type_info& typ2,
22
const
std::type_info& typ3 );
23
std::string
keyedContainerName
(
const
std::string& prefix,
const
std::type_info& typ1 );
24
}
// namespace GaudiDict
25
26
static
std::string clean( std::string c ) {
27
for
(
size_t
occ =
c
.find(
" *"
); occ != std::string::npos; occ =
c
.find(
" *"
) )
c
.replace( occ, 2,
"*"
);
28
return
c
;
29
}
30
31
std::string
GaudiDict::typeName
(
const
std::type_info& typ ) {
32
std::string r = clean(
System::typeinfoName
( typ ) );
33
// if ( r.compare(0,4,"enum") == 0 ) {
34
// r = "int";
35
//}
36
return
r;
37
}
38
39
std::string
GaudiDict::templateName1
( std::string templ,
const
std::type_info& typ ) {
40
return
templateName1
( std::move( templ ),
typeName
( typ ) );
41
}
42
43
std::string
GaudiDict::templateName1
( std::string s,
const
std::string& typ ) {
44
s +=
"<"
;
45
s += typ;
46
s += ( s.back() ==
'>'
) ?
" >"
:
">"
;
// with C++11, we can have <somename<T>>...
47
return
clean( s );
48
}
49
50
std::string
GaudiDict::templateName2
( std::string s,
const
std::type_info& typ1,
const
std::type_info& typ2 ) {
51
s +=
"<"
;
52
s +=
typeName
( typ1 );
53
s +=
","
;
54
s +=
typeName
( typ2 );
55
s += ( s.back() ==
'>'
) ?
" >"
:
">"
;
56
return
clean( s );
57
}
58
59
std::string
GaudiDict::templateName3
( std::string s,
const
std::type_info& typ1,
const
std::type_info& typ2,
60
const
std::type_info& typ3 ) {
61
s +=
"<"
;
62
s +=
typeName
( typ1 );
63
s +=
","
;
64
s +=
typeName
( typ2 );
65
s +=
","
;
66
s +=
typeName
( typ3 );
67
s += ( s.back() ==
'>'
) ?
" >"
:
">"
;
68
return
clean( s );
69
}
70
71
std::string
GaudiDict::vectorName
(
const
std::type_info& typ ) {
return
templateName1
(
"std::vector"
, typ ); }
72
73
std::string
GaudiDict::vectorName
(
const
std::string& typ ) {
return
templateName1
(
"std::vector"
, typ ); }
74
75
std::string
GaudiDict::pairName
(
const
std::type_info& typ1,
const
std::type_info& typ2 ) {
76
return
templateName2
(
"std::pair"
, typ1, typ2 );
77
}
78
79
std::string
GaudiDict::keyedContainerName
(
const
std::string& mgr_typ,
const
std::type_info& typ1 ) {
80
std::string s =
"KeyedContainer<"
;
81
s +=
typeName
( typ1 );
82
s +=
","
;
83
s += mgr_typ;
84
if
( mgr_typ[mgr_typ.length() - 1] ==
'>'
) s +=
" "
;
85
s +=
">"
;
86
return
clean( s );
87
}
88
89
std::string
GaudiDict::relationName
(
const
std::string&
/* prefix */
,
const
std::type_info&
/* typ1 */
,
90
const
std::type_info&
/* typ2 */
) {
91
return
""
;
92
}
System.h
GaudiDict
Definition
KeyedContainer.h:19
GaudiDict::templateName3
std::string templateName3(std::string templ, const std::type_info &typ1, const std::type_info &typ2, const std::type_info &typ3)
Definition
Dictionary.cpp:59
GaudiDict::templateName1
std::string templateName1(std::string templ, const std::type_info &typ)
Definition
Dictionary.cpp:39
GaudiDict::vectorName
std::string vectorName(const std::type_info &typ)
Definition
Dictionary.cpp:71
GaudiDict::typeName
std::string typeName(const std::type_info &typ)
Definition
Dictionary.cpp:31
GaudiDict::pairName
std::string pairName(const std::type_info &typ1, const std::type_info &typ2)
Definition
Dictionary.cpp:75
GaudiDict::templateName2
std::string templateName2(std::string templ, const std::type_info &typ1, const std::type_info &typ2)
Definition
Dictionary.cpp:50
GaudiDict::relationName
std::string relationName(const std::string &prefix, const std::type_info &typ1, const std::type_info &typ2)
Definition
Dictionary.cpp:89
GaudiDict::keyedContainerName
std::string keyedContainerName(const std::string &prefix, const std::type_info &typ1)
Definition
Dictionary.cpp:79
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition
System.cpp:254
gaudirun.c
c
Definition
gaudirun.py:533
GaudiKernel
src
Lib
Dictionary.cpp
Generated on
for The Gaudi Framework by
1.17.0