| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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