| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- File List
- File Members

# Dictionary.cpp

Go to the documentation of this file.

    00001 #include "GaudiKernel/System.h"
    00002 namespace GaudiDict {
    00003   std::string typeName(const std::type_info& typ);
    00004   std::string vectorName(const std::type_info& typ);
    00005   std::string vectorName(const std::string& typ);
    00006   std::string pairName(const std::type_info& typ1, const std::type_info& typ2);
    00007   std::string relationName(const std::string& prefix, const std::type_info& typ1, const std::type_info& typ2);
    00008   std::string templateName1(const std::string& templ, const std::type_info& typ);
    00009   std::string templateName1(const std::string& templ, const std::string& typ);
    00010   std::string templateName2(const std::string& templ, const std::type_info& typ1, const std::type_info& typ2);
    00011   std::string templateName3(const std::string& templ, const std::type_info& typ1, const std::type_info& typ2, const std::type_info& typ3);
    00012   std::string keyedContainerName(const std::string& prefix, const std::type_info& typ1);
    00013 }
    00014
    00015 static std::string clean(const std::string& s)  {
    00016   std::string c = s;
    00017   for(size_t occ=c.find(" *"); occ != std::string::npos; occ=c.find(" *"))
    00018     c.replace(occ,2,"*");
    00019   return c;
    00020 }
    00021
    00022 std::string GaudiDict::typeName(const std::type_info& typ)  {
    00023   std::string r = clean(System::typeinfoName(typ));
    00024   //if ( r.substr(0,4) == "enum" )  {
    00025   //  r = "int";
    00026   //}
    00027   return r;
    00028 }
    00029
    00030 std::string GaudiDict::templateName1(const std::string& templ, const std::type_info& typ)  {
    00031   return templateName1(templ, typeName(typ));
    00032 }
    00033
    00034 std::string GaudiDict::templateName1(const std::string& templ, const std::string& typ)  {
    00035   std::string s = templ + "<";
    00036   s += typ;
    00037   s += (s[s.length()-1] == '>') ? " >" : ">";
    00038   return clean(s);
    00039 }
    00040
    00041 std::string GaudiDict::templateName2(const std::string& templ, const std::type_info& typ1, const std::type_info& typ2)  {
    00042   std::string s = templ + "<";
    00043   s += typeName(typ1);
    00044   s += ",";
    00045   s += typeName(typ2);
    00046   s += (s[s.length()-1] == '>') ? " >" : ">";
    00047   return clean(s);
    00048 }
    00049
    00050 std::string GaudiDict::templateName3(const std::string& templ, const std::type_info& typ1, const std::type_info& typ2, const std::type_info& typ3)  {
    00051   std::string s = templ + "<";
    00052   s += typeName(typ1);
    00053   s += ",";
    00054   s += typeName(typ2);
    00055   s += ",";
    00056   s += typeName(typ3);
    00057   s += (s[s.length()-1] == '>') ? " >" : ">";
    00058   return clean(s);
    00059 }
    00060
    00061 std::string GaudiDict::vectorName(const std::type_info& typ)   {
    00062   return templateName1("std::vector", typ);
    00063 }
    00064
    00065 std::string GaudiDict::vectorName(const std::string& typ)   {
    00066   return templateName1("std::vector", typ);
    00067 }
    00068
    00069 std::string GaudiDict::pairName(const std::type_info& typ1, const std::type_info& typ2)  {
    00070   return templateName2("std::pair", typ1, typ2);
    00071 }
    00072
    00073 std::string GaudiDict::keyedContainerName(const std::string& mgr_typ, const std::type_info& typ1)   {
    00074   std::string s = "KeyedContainer<";
    00075   s += typeName(typ1);
    00076   s += ",";
    00077   s += mgr_typ;
    00078   if ( mgr_typ[mgr_typ.length()-1]=='>' ) s += " ";
    00079   s += ">";
    00080   return clean(s);
    00081 }
    00082
    00083 std::string GaudiDict::relationName(const std::string& /* prefix */, const std::type_info& /* typ1 */, const std::type_info& /* typ2 */)   {
    00084   return "";
    00085 }