The Gaudi Framework  v29r0 (ff2e7097)
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 );
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 );
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 );
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 
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 
33 {
34  return templateName1( std::move( templ ), typeName( typ ) );
35 }
36 
38 {
39  s += "<";
40  s += typ;
41  s += ( s.back() == '>' ) ? " >" : ">"; // with C++11, we can have <somename<T>>...
42  return clean( s );
43 }
44 
46 {
47  s += "<";
48  s += typeName( typ1 );
49  s += ",";
50  s += typeName( typ2 );
51  s += ( s.back() == '>' ) ? " >" : ">";
52  return clean( s );
53 }
54 
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 
73 {
74  return templateName2( "std::pair", typ1, typ2 );
75 }
76 
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 }
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
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
std::string templateName2(std::string templ, const std::type_info &typ1, const std::type_info &typ2)
Definition: Dictionary.cpp:45
std::string keyedContainerName(const std::string &prefix, const std::type_info &typ1)
Definition: Dictionary.cpp:77
STL class.
T replace(T...args)
std::string pairName(const std::type_info &typ1, const std::type_info &typ2)
Definition: Dictionary.cpp:72
string prefix
Definition: gaudirun.py:268
T move(T...args)
T find(T...args)
T length(T...args)
std::string relationName(const std::string &prefix, const std::type_info &typ1, const std::type_info &typ2)
Definition: Dictionary.cpp:88
std::string templateName1(std::string templ, const std::type_info &typ)
Definition: Dictionary.cpp:32
T back(T...args)
string s
Definition: gaudirun.py:253
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:23
std::string vectorName(const std::type_info &typ)
Definition: Dictionary.cpp:68