| The Gaudi Framework v28r2p1 (f1a77ff4)

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